代码之家  ›  专栏  ›  技术社区  ›  James farmer

找不到“Normal”Maui App.xaml的枚举值

  •  0
  • James farmer  · 技术社区  · 1 年前

    完成了从Xamarin到Maui.net 8的迁移,我得到了以下错误,没有行号,所以我可以确定问题所在。

    下面是app.xaml,它说erro源于

    在代码中,唯一使用普通枚举的是按钮。我搜索过没有看到这个话题。无论如何,我不是一个伟大的xaml编码器,我主要是汇编和c嵌入。所以对我宽容一点。

    <?xml version="1.0" encoding="utf-8" ?>
    <Application
        x:Class="TwosenseChatterbox.App"
        xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        xmlns:converters="clr-namespace:TwosenseChatterbox.Behaviors"
        xmlns:themes="clr-namespace:TwosenseChatterbox.Themes;assembly=TwosenseChatterbox" 
        xmlns:vm="clr-namespace:TwosenseChatterbox.ViewModels">
        <Application.Resources>
            <!--  Colors  -->
    
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <themes:LightTheme />
                </ResourceDictionary.MergedDictionaries>
    
                <vm:ViewModelLocator x:Key="locator" />
                <converters:StringToBoolConverter x:Key="EnabledWhenFilledConverter" />
                <converters:StringToFloatConverter x:Key="OpaqueWhenFilledConverter" />
    
                <!--  Styles  -->
    
                <Style x:Key="stackLayoutStyle" TargetType="StackLayout">
                    <Setter Property="Orientation">
                        <Setter.Value>
                            <OnIdiom
                                x:TypeArguments="StackOrientation"
                                Phone="Vertical"
                                Tablet="Horizontal" />
                        </Setter.Value>
                    </Setter>
                </Style>
    
                <Style x:Key="BlackTitleBar_Wrapper" TargetType="StackLayout">
                    <Setter Property="BackgroundColor" Value="White" />
                    <Setter Property="Padding" Value="0,0,0,1" />
                </Style>
    
                <Style x:Key="BlackTitleBar" TargetType="StackLayout">
                    <Setter Property="BackgroundColor" Value="#181818" />
                    <Setter Property="Padding" Value="10,5,10,5" />
                </Style>
    
                <Style x:Key="WhiteTitleBarLabel" TargetType="Label">
                    <Setter Property="TextColor" Value="White" />
                    <Setter Property="FontSize" Value="20" />
                    <Setter Property="FontAttributes" Value="Bold" />
                </Style>
    
                <Style x:Key="EntryStyle" TargetType="Entry">
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="FontSize" Value="15" />
                </Style>
    
                <Style x:Key="PageTitleLg" TargetType="Label">
                    <Setter Property="FontSize">40</Setter>
                    <Setter Property="FontAttributes">Bold</Setter>
                    <Setter Property="TextColor" Value="{StaticResource Secondary}" />
                </Style>
    
                <Style x:Key="PageTitleMed" TargetType="Label">
                    <Setter Property="FontSize">25</Setter>
                    <Setter Property="FontAttributes">Bold</Setter>
                    <Setter Property="TextColor" Value="{StaticResource Secondary}" />
                </Style>
    
                <Style x:Key="PageTitleSm" TargetType="Label">
                    <Setter Property="FontSize">18</Setter>
                    <Setter Property="FontAttributes">Bold</Setter>
                    <Setter Property="TextColor" Value="Black" />
                </Style>
    
                <Style x:Key="Hyperlink" TargetType="Label">
                    <Setter Property="FontSize">18</Setter>
                    <Setter Property="TextColor" Value="{StaticResource Secondary}" />
                </Style>
    
                <Style x:Key="labelTitle" TargetType="Label">
                    <Setter Property="FontSize">17</Setter>
                    <Setter Property="FontAttributes">Bold</Setter>
                    <Setter Property="TextColor" Value="Black" />
                </Style>
    
                <Style x:Key="label" TargetType="Label">
                    <Setter Property="FontSize">17</Setter>
                    <Setter Property="FontAttributes">Normal</Setter>
                    <Setter Property="TextColor" Value="Black" />
                </Style>
    
    
                <Style x:Key="StatusLabel" TargetType="Label">
                    <Setter Property="FontSize">17</Setter>
                    <Setter Property="FontAttributes" Value="Bold"/>
                    <Setter Property="TextColor" Value="{StaticResource PrimaryDarkColor}" />
                </Style>
    
    
    
    
                <Color x:Key="CustomerColor">White</Color>
                <Color x:Key="QrColor">White</Color>
                <Color x:Key="SummColor">White</Color>
                <Color x:Key="AWSColor">White</Color>
                <Style x:Key="srTitle" TargetType="Label">
                    <Setter Property="FontSize" Value="18" />
                    <Setter Property="HorizontalOptions" Value="CenterAndExpand" />
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="FontAttributes" Value="Bold"/>
                    <Setter Property="Margin" Value="0, 0, 0, 6" />
                </Style>
    
                <Style x:Key="srBody" TargetType="Label">
                    <Setter Property="FontSize" Value="14" />
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="Margin" Value="48, 0" />
                    <Setter Property="FontAttributes" Value="Bold"/>
                    <Setter Property="HorizontalTextAlignment" Value="Center" />
                    <Setter Property="HorizontalOptions" Value="CenterAndExpand" />
                </Style>
    
                <Style x:Key="srLgTitle" TargetType="Label">
                    <Setter Property="FontSize" Value="22" />
                    <Setter Property="HorizontalOptions" Value="CenterAndExpand" />
                    <Setter Property="TextColor" Value="{StaticResource PrimaryDarkColor}" />
                    <Setter Property="FontAttributes" Value="Bold"/>
                    <Setter Property="Margin" Value="0, 0, 0, 6" />
                </Style>
    
                <Style x:Key="srLgBody" TargetType="Label">
                    <Setter Property="FontSize" Value="18" />
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="Margin" Value="48, 0" />
                    <Setter Property="HorizontalTextAlignment" Value="Center" />
                    <Setter Property="FontAttributes" Value="None"/>
                    <Setter Property="HorizontalOptions" Value="CenterAndExpand" />
                </Style>
    
                <Style x:Key="BlackTitleBarLabel" TargetType="Label">
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="FontSize" Value="15" />
                    <Setter Property="FontAttributes" Value="Bold" />
                </Style>
                <Style x:Key="BlackTitleBarLabelLarge" TargetType="Label">
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="FontSize" Value="45" />
                    <Setter Property="FontAttributes" Value="Bold" />
                </Style>
    
                <Style x:Key="boldWhiteTextLabel" TargetType="Label">
                    <Setter Property="TextColor" Value="White" />
                    <Setter Property="FontSize" Value="13" />
                    <Setter Property="FontAttributes" Value="Bold" />
                </Style>
    
                <Style x:Key="blackTextLabel" TargetType="Label">
                    <Setter Property="TextColor" Value="#181818" />
                    <Setter Property="FontSize" Value="13" />
                    <Setter Property="FontAttributes" Value="None" />
                </Style>
    
                <Style x:Key="whiteTextLabel" TargetType="Label">
                    <Setter Property="TextColor" Value="White" />
                    <Setter Property="FontSize" Value="13" />
                </Style>
    
                <Style x:Key="listViewWrapper" TargetType="StackLayout">
                    <Setter Property="Orientation" Value="Vertical" />
                    <Setter Property="BackgroundColor" Value="#181818" />
                    <Setter Property="Padding" Value="0,1,0,1" />
                    <Setter Property="Spacing" Value="0" />
    
                </Style>
    
    
                <!--  List View Light  -->
    
                <Style x:Key="listViewLight" TargetType="StackLayout">
                    <Setter Property="BackgroundColor" Value="White" />
                    <Setter Property="Padding" Value="20,10,20,10" />
                    <Setter Property="Margin" Value="0,0,0,0" />
                </Style>
    
                <Style x:Key="listViewLightBorder" TargetType="StackLayout">
                    <Setter Property="Padding" Value="0,0,0,1" />
                    <Setter Property="BackgroundColor" Value="#E8E8E8" />
                </Style>
    
                <Style x:Key="listViewLightTitle" TargetType="Label">
                    <Setter Property="TextColor" Value="{StaticResource Secondary}" />
                    <Setter Property="FontSize" Value="26" />
                    <Setter Property="FontAttributes" Value="Bold" />
                </Style>
    
                <Style x:Key="listViewLightTitleMed" TargetType="Label">
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="FontSize" Value="18" />
                    <Setter Property="FontAttributes" Value="Bold" />
                </Style>
                <Style x:Key="listViewLightTitleSm" TargetType="Label">
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="FontSize" Value="17" />
                    <Setter Property="FontAttributes" Value="Bold" />
                </Style>
    
    
    
                <Style x:Key="ValueLabel" TargetType="Label">
                    <Setter Property="FontSize">12</Setter>
                    <Setter Property="TextColor" Value="Black" />
                </Style>
                <Style x:Key="listViewLightLabel" TargetType="Label">
                    <Setter Property="TextColor" Value="#484848" />
                    <Setter Property="FontSize" Value="16" />
                    <Setter Property="HorizontalTextAlignment" Value="Center" />
                </Style>
                <Style x:Key="listViewDarkLabel" TargetType="Label">
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="FontSize" Value="Small" />
                    <Setter Property="HorizontalTextAlignment" Value="Center" />
                </Style>
                <Style x:Key="listViewDarkTitle" TargetType="Label">
                    <Setter Property="TextColor" Value="LightGray" />
                    <Setter Property="FontSize" Value="Large" />
                    <Setter Property="HorizontalTextAlignment" Value="Center" />
                </Style>
                <Style x:Key="DefaultFrame" TargetType="Frame">
                    <Setter Property="BackgroundColor" Value="White" />
                    <Setter Property="BorderColor" Value="Transparent" />
    
                    <Setter Property="HorizontalOptions" Value="FillAndExpand" />
                    <Setter Property="VerticalOptions" Value="FillAndExpand" />
                </Style>
                <Style x:Key="ActionFrame" TargetType="Frame">
                    <Setter Property="BackgroundColor" Value="#002d72" />
                    <Setter Property="BorderColor" Value="#0072ce" />
                    <Setter Property="CornerRadius" Value="20" />
                    <Setter Property="HasShadow" Value="True" />
                </Style>
    
                <Style x:Key="CognitoButton" TargetType="Button">
                    <Setter Property="BackgroundColor" Value="#002d72" />
                    <Setter Property="TextColor" Value="White" />
                    <Setter Property="CornerRadius" Value="15" />
                    <Setter Property="FontSize" Value="20" />
                    <Setter Property="Margin" Value="30,0" />
                    <Setter Property="Padding" Value="10" />
                    <Setter Property="FontFamily" Value="Arial-Rounded" />
                </Style>
    
                <Style x:Key="CognitoRegistrationButton" TargetType="Button">
                    <Setter Property="BackgroundColor" Value="Green" />
                    <Setter Property="HorizontalOptions" Value="FillAndExpand" />
                    <Setter Property="TextColor" Value="White" />
                    <Setter Property="FontSize" Value="24" />
                    <Setter Property="HeightRequest" Value="76" />
                </Style>
                <Style x:Key="CognitoEntry" TargetType="Entry">
                    <Setter Property="HorizontalOptions" Value="FillAndExpand" />
                    <Setter Property="Margin" Value="0,0,0,12" />
                </Style>
                <Style x:Key="CognitoPasswordEntry" TargetType="Entry">
                    <Setter Property="HorizontalOptions" Value="FillAndExpand" />
                    <Setter Property="IsPassword" Value="True" />
                    <Setter Property="Margin" Value="0,0,0,12" />
                </Style>
                <Style x:Key="CognitoLabel" TargetType="Label">
                    <Setter Property="HorizontalOptions" Value="FillAndExpand" />
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="FontSize" Value="Medium" />
                </Style>
    
    
                <Style TargetType="Button">
                    <Setter Property="TextColor" Value="White" />
                    <Setter Property="VisualStateManager.VisualStateGroups">
                        <VisualStateGroupList>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <VisualState.Setters>
                                        <Setter Property="BackgroundColor" Value="{StaticResource Secondary}" />
                                        <Setter Property="FontAttributes" Value="Bold"/>
                                    </VisualState.Setters>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <VisualState.Setters>
                                        <Setter Property="BackgroundColor" Value="{StaticResource Primary}" />
                                        <Setter Property="FontAttributes" Value="Bold"/>
                                    </VisualState.Setters>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateGroupList>
                    </Setter>
                </Style>
    
                <Style x:Key="LightGrayBtn" TargetType="Button">
                    <Setter Property="TextColor" Value="Black" />
                    <Setter Property="VisualStateManager.VisualStateGroups">
                        <VisualStateGroupList>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <VisualState.Setters>
                                        <Setter Property="BackgroundColor" Value="{StaticResource Gray-200}" />
                                        <Setter Property="FontAttributes" Value="Bold"/>
                                    </VisualState.Setters>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <VisualState.Setters>
                                        <Setter Property="BackgroundColor" Value="{StaticResource Gray-100}" />
                                        <Setter Property="FontAttributes" Value="Bold"/>
                                    </VisualState.Setters>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateGroupList>
                    </Setter>
                </Style>
            </ResourceDictionary>
    
        </Application.Resources>
    </Application>
    
    1 回复  |  直到 1 年前
        1
  •  1
  •   Dai    1 年前

    我推断你的错误就在这里:

                <Style x:Key="label" TargetType="Label">
                    <Setter Property="FontSize">17</Setter>
                    <Setter Property="FontAttributes">Normal</Setter>
                    <Setter Property="TextColor" Value="Black" />
                </Style>
    

    The enum Microsoft.Maui.Controls.FontAttributes 类型没有名为的成员 Normal -将其更改为 None .

    好奇地 Xamarin.Forms.FontAttributes also lacks a Normal member too ,所以我想知道你在哪里 典型的 从一开始。