如何解决如何在开关上改变颜色?
我有2个项目。在两个我风格切换。更新VS后,添加新项目时我遇到了问题
<Switch>
<visualstatemanager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="On">
<VisualState.Setters>
<Setter Property="ThumbColor"
Value="#2D78FD" />
<Setter Property="OnColor"
Value="#2D78FD" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Off">
<VisualState.Setters>
<Setter Property="ThumbColor"
Value="LightGray" />
<Setter Property="OnColor"
Value="LightGray" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</visualstatemanager.VisualStateGroups>
</Switch>
我了解自己在主题方面遇到了问题 我的手机上有深色主题,所以我写
BackgroundColor="{AppThemeBinding Light=White,Dark=White}"
然后我有白色BackgroundColor,并且开关有问题 enter image description here
如果我不写
BackgroundColor="{AppThemeBinding Light=White,Dark=White}"
为什么我的OnColor在关闭时不能在白色BackgroundColor上起作用(我尝试了其他颜色,只有ThumbColor更改了颜色)
解决方法
请将您的Xamarin.forms版本更新到最新的4.8.0.1364
,我测试了您的代码,它运行良好。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。