我已经使用升级助手将我的Xamarin Forms解决方案迁移到了MAUI,但是在迁移之后,当我构建项目时,我遇到了所有.xaml文件的问题:
1>App.xaml:错误:值不能为空。1>App.xaml:错误:参数名:钥匙...
有人能帮我。
我已经尝试了2次升级我的解决方案,这是同样的问题。
app.xaml代码:
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="CheckMobile.App">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Warning">#FF8C00</Color>
<Color x:Key="Error">#FF0000</Color>
<Color x:Key="Agree">#008000</Color>
<Color x:Key="Info">#3276b1</Color>
<Color x:Key="Secondary">#EBEBEB</Color>
<Color x:Key="DarkSecondary">#868e96</Color>
<Style x:Key="searchFrame" TargetType="Frame">
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="HorizontalOptions" Value="FillAndExpand" />
<Setter Property="Padding" Value="5,10,5,10" />
<Setter Property="Margin" Value="0,0,2,0" />
<Setter Property="OutlineColor" Value="{StaticResource Warning}"/>
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}"/>
<Setter Property="HasShadow" Value="True"/>
</Style>
<Style x:Key="searchNotMandatoryFrame" TargetType="Frame">
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="HorizontalOptions" Value="FillAndExpand" />
<Setter Property="Padding" Value="5,10,5,10" />
<Setter Property="Margin" Value="0,0,2,0" />
<Setter Property="OutlineColor" Value="{StaticResource Info}"/>
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}"/>
<Setter Property="HasShadow" Value="True"/>
</Style>
<Style x:Key="infoFrame" TargetType="Frame">
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="HorizontalOptions" Value="FillAndExpand" />
<Setter Property="Padding" Value="5,10,5,10" />
<Setter Property="Margin" Value="0,0,2,0" />
<Setter Property="OutlineColor" Value="{StaticResource Info}"/>
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}"/>
<Setter Property="HasShadow" Value="True"/>
</Style>
<Style x:Key="btnImage" TargetType="Button">
<Setter Property="BorderColor" Value="{StaticResource Info}" />
<Setter Property="BorderRadius" Value="5" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="TextColor" Value="{StaticResource Info}" />
<Setter Property="FontSize" Value="11" />
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}"/>
<Setter Property="HeightRequest" Value="40"/>
</Style>
<Style x:Key="btnStyle" TargetType="Button">
<Setter Property="BorderColor" Value="{StaticResource Info}" />
<Setter Property="BorderRadius" Value="5" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="TextColor" Value="{StaticResource Info}" />
<Setter Property="FontSize" Value="Small" />
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}" />
</Style>
<Style x:Key="btnSecondaryStyle" TargetType="Button">
<Setter Property="BorderColor" Value="{StaticResource DarkSecondary}" />
<Setter Property="BorderRadius" Value="5" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="TextColor" Value="{StaticResource DarkSecondary}" />
<Setter Property="FontSize" Value="Small" />
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}" />
</Style>
<Style x:Key="btnAgreeStyle" TargetType="Button">
<Setter Property="BorderColor" Value="{StaticResource Agree}" />
<Setter Property="BorderRadius" Value="5" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="TextColor" Value="{StaticResource Agree}" />
<Setter Property="FontSize" Value="Small" />
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}" />
</Style>
<Style x:Key="btnWarningStyle" TargetType="Button">
<Setter Property="BorderColor" Value="{StaticResource Warning}" />
<Setter Property="BorderRadius" Value="5" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="TextColor" Value="{StaticResource Warning}" />
<Setter Property="FontSize" Value="Small" />
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}" />
</Style>
<Style x:Key="btnErrorStyle" TargetType="Button">
<Setter Property="BorderColor" Value="{StaticResource Error}" />
<Setter Property="BorderRadius" Value="5" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="TextColor" Value="{StaticResource Error}" />
<Setter Property="FontSize" Value="Small" />
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}" />
</Style>
<Style x:Key="entryStyle" TargetType="Entry">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="{StaticResource Info}" />
<Setter Property="BackgroundColor" Value="#FFFFFF" />
</Style>
<Style x:Key="entryWarningStyle" TargetType="Entry">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="{StaticResource Warning}" />
<Setter Property="BackgroundColor" Value="#FFFFFF" />
</Style>
<Style x:Key="editorStyle" TargetType="Editor">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="{StaticResource Info}" />
<Setter Property="PlaceholderColor" Value="{StaticResource Info}" />
<Setter Property="BackgroundColor" Value="#FFFFFF" />
</Style>
<Style x:Key="lblMicroStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="{StaticResource Info}" />
</Style>
<Style x:Key="lblStyle" TargetType="Label">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="{StaticResource Info}" />
</Style>
<Style x:Key="lblAgreeStyle" TargetType="Label">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="{StaticResource Agree}" />
</Style>
<Style x:Key="lblAgreeMicroStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="{StaticResource Agree}" />
</Style>
<Style x:Key="lblWarningStyle" TargetType="Label">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="{StaticResource Warning}" />
</Style>
<Style x:Key="lblWarningMicroStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="{StaticResource Warning}" />
</Style>
<Style x:Key="lblErrorStyle" TargetType="Label">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="{StaticResource Error}" />
</Style>
<Style x:Key="lblErrorMicroStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="{StaticResource Error}" />
</Style>
<Style x:Key="lblDarkSecondaryStyle" TargetType="Label">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="{StaticResource DarkSecondary}" />
</Style>
<Style x:Key="lblDarkSecondaryMicroStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="{StaticResource DarkSecondary}" />
</Style>
<Style x:Key="lblInfoStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="#FCFCFC" />
<Setter Property="BackgroundColor" Value="{StaticResource Info}" />
</Style>
<Style x:Key="lblSmallInfoStyle" TargetType="Label">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="#FCFCFC" />
<Setter Property="BackgroundColor" Value="{StaticResource Info}" />
</Style>
<Style x:Key="lblInfoLargeStyle" TargetType="Label">
<Setter Property="FontSize" Value="Large" />
<Setter Property="TextColor" Value="#FCFCFC" />
<Setter Property="BackgroundColor" Value="{StaticResource Info}" />
</Style>
<Style x:Key="lblInfoErrorLargeStyle" TargetType="Label">
<Setter Property="FontSize" Value="Large" />
<Setter Property="TextColor" Value="#FCFCFC" />
<Setter Property="BackgroundColor" Value="{StaticResource Error}" />
</Style>
<Style x:Key="lblInfoSecondaryStyle" TargetType="Label">
<Setter Property="FontSize" Value="Small" />
<Setter Property="TextColor" Value="#000000" />
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}" />
</Style>
<Style x:Key="lblInfoMicroSecondaryStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="#000000" />
<Setter Property="BackgroundColor" Value="{StaticResource Secondary}" />
</Style>
<Style x:Key="lblInfoErrorMicroStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="#FCFCFC" />
<Setter Property="BackgroundColor" Value="{StaticResource Error}" />
</Style>
<Style x:Key="lblInfoWarningMicroStyle" TargetType="Label">
<Setter Property="FontSize" Value="11" />
<Setter Property="TextColor" Value="#FCFCFC" />
<Setter Property="BackgroundColor" Value="{StaticResource Warning}" />
</Style>
<Style x:Key="lblWarningLargeStyle" TargetType="Label">
<Setter Property="FontSize" Value="Large" />
<Setter Property="TextColor" Value="{StaticResource Warning}" />
</Style>
<Style x:Key="lblLargeStyle" TargetType="Label">
<Setter Property="FontSize" Value="Large" />
<Setter Property="TextColor" Value="{StaticResource Info}" />
</Style>
<Style x:Key="searchStyle" TargetType="SearchBar">
<Setter Property="FontSize" Value="Small" />
<Setter Property="BackgroundColor" Value="#FCFCFC" />
<Setter Property="TextColor" Value="{StaticResource Info}" />
<Setter Property="HeightRequest" Value="30" />
</Style>
<Style x:Key="lvStyle" TargetType="ListView">
<Setter Property="BackgroundColor" Value="#FCFCFC" />
<Setter Property="RowHeight" Value="50" />
<Setter Property="SeparatorVisibility" Value="Default" />
<Setter Property="SeparatorColor" Value="{StaticResource Info}" />
</Style>
<Style x:Key="lvNoHeightStyle" TargetType="ListView">
<Setter Property="BackgroundColor" Value="#FCFCFC" />
<Setter Property="SeparatorVisibility" Value="Default" />
<Setter Property="SeparatorColor" Value="{StaticResource Info}" />
</Style>
<Style x:Key="lvPictureStyle" TargetType="ListView">
<Setter Property="BackgroundColor" Value="#FCFCFC" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
多谢了
Xamarin格式到MAUI迁移
1条答案
按热度按时间8fsztsew1#
您正在使用不存在的属性名。
按钮的BorderRadius。
如果我们打开button类,我们会看到:
你拥有的这个XAML永远不会工作。你得把它修好。
另外,我建议使用合并字典,并在样式XAML中分离样式。
编辑:现在当我仔细看的时候,Frame也没有OutlineColor...
看来你得在你的项目中替换掉它们。。做一个测试项目,看看它们看起来是否相同。