gpt4 book ai didi

xaml - Rider Xamarin xaml : "Field Normal is already declared" from VisualStateManager

转载 作者:行者123 更新时间:2023-12-04 01:24:07 24 4
gpt4 key购买 nike

我正在使用 Xamarin Forms 4.5.0.617 并且想使用 VisualStateManager ( https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual-state-manager ) 在元素被禁用时更改样式。要将其应用于我的所有样式,我必须多次使用 x:Name="Normal"或 "Disabled"或 "Focused",但 Rider ( https://www.jetbrains.com/de-de/rider/ ) 说 error应用程序运行正常(风格正在改变),但 Rider 的警告仍然很烦人。

我做错了什么吗?

<?xml version="1.0" encoding="utf-8"?>

<Application
x:Class="ProjectApp.App"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:components="clr-namespace:Project.Components"
xmlns:converters="clr-namespace:Project.Converters"
xmlns:helpers="clr-namespace:Project.Helpers"
xmlns:iconize="clr-namespace:Plugin.Iconize;assembly=Plugin.Iconize">

<Application.Resources>
<ResourceDictionary>

<!-- Text -->
<Style
x:Key="Label"
TargetType="Label">
<Setter
Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup>
<VisualState
x:Name="Normal">
<VisualState.Setters>
<Setter
Property="TextColor"
Value="Black" />
</VisualState.Setters>
</VisualState>
<VisualState
x:Name="Disabled">
<VisualState.Setters>
<Setter
Property="TextColor"
Value="Gray" />
</VisualState.Setters>
</VisualState>
<VisualState
x:Name="Focused">
<VisualState.Setters>
<Setter
Property="TextColor"
Value="{StaticResource Primary}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>

<!-- Picker -->
<Style
x:Key="Picker"
TargetType="Picker">
<Setter
Property="FontSize"
Value="14" />
<Setter
Property="TextColor"
Value="Black" />
<Setter
Property="VerticalOptions"
Value="Center" />
<Setter
Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup>
<VisualState
x:Name="Normal">
<VisualState.Setters>
<Setter
Property="TextColor"
Value="Black" />
</VisualState.Setters>
</VisualState>
<VisualState
x:Name="Disabled">
<VisualState.Setters>
<Setter
Property="TextColor"
Value="Gray" />
</VisualState.Setters>
</VisualState>
<VisualState
x:Name="Focused">
<VisualState.Setters>
<Setter
Property="TextColor"
Value="{StaticResource Primary}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>

</ResourceDictionary>
</Application.Resources>
</Application>

最佳答案

你没有做错任何事。这是已确认的 Rider/ReSharper 已知问题。我已经举报了here .

我可以建议您对该问题投赞成票和/或发表评论,以便他们可以将其升级并快速修复。

关于xaml - Rider Xamarin xaml : "Field Normal is already declared" from VisualStateManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62171963/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com