.NET MAUI
一种 Microsoft 开源框架,用于构建跨移动设备、平板电脑、台式机的原生设备应用程序。
130 个问题
您好~
下面这段代码,在手机上一直显示灰色,理论上它应该在禁用状态下应该显示粉红色,我反复对比了示例代码,没有找出问题,请求帮助。
测试环境:.net8 , android api33, oppo手机
<Label x:Name="Label_Pushing"
Text="推送"
FontSize="10"
FontAttributes="Bold"
TextColor="White"
HorizontalTextAlignment="Center"
IsEnabled="False">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState Name="Disabled">
<VisualState.Setters>
<Setter TargetName="Label_Pushing" Property="Label.TextColor" Value="Pink" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Label>
你好,
你需要为VisualStateGroups设置VisualStateGroupList属性。
<Label x:Name="Label_Pushing"
Text="推送"
FontSize="10"
FontAttributes="Bold"
TextColor="White"
HorizontalTextAlignment="Center"
IsEnabled="False">
<VisualStateManager.VisualStateGroups>
<VisualStateGroupList>
<VisualStateGroup>
<VisualState Name="Disabled">
<VisualState.Setters>
<Setter TargetName="Label_Pushing" Property="Label.TextColor" Value="Pink" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</VisualStateManager.VisualStateGroups>
</Label>
请参考此官方文档。
如果答案是正确的,请点击“接受答案”并点赞。 如果您对此答案还有其他疑问,请点击“评论”。 注意:如果您想接收相关电子邮件,请按照我们的文档中的步骤启用电子邮件通知 此线程的通知。