确实,问题出在你期望的地方。在你的情况下,VisualState PointerOver将边框画笔和背景的不透明度设置为新值。如果您想保持背景,请移除下面代码中标记的部分。
我可能会保留边框笔突出显示,以便用户仍然看到该控件是重点。但是,如果需要,也可以删除(实际上是整个视觉状态)。
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="BorderElement">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeAltLowBrush}" />
</ObjectAnimationUsingKeyFrames>
<!-- Remove the following -->
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundElement">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundHoverOpacity}" />
</ObjectAnimationUsingKeyFrames>
<!-- until here -->
</Storyboard>
</VisualState>
这将意味着有'Xamain.Forms'的自定义生成是有办法,我可以设置'TextControlBackgroundHoverOpacity'的价值在我的'App.xaml'去改变? – user1
@ user1对,没有意识到它是Xamarin.Forms的内部代码。然后我会更新UWP特定代码中TextControlBackgroundHoverOpacity的值。像这样:Windows.UI.Xaml.Application.Current.Resources [“TextControlBackgroundHoverOpacity”] = 1;您也许可以通过编程方式删除VisualState,但我正在通话并且无法立即验证它。 – hankide
是否可以替换xaml中的资源? – user1