我希望我的文本框有白色背景,即使在轻的主题。我查看了它的控制模板,并看到了这个
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EnabledBorder" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxEditBackgroundBrush}" />
</ObjectAnimationUsingKeyFrames>
....看起来它将画刷设置为资源PhoneTextBoxEditBackgroundBrush,因此
我在网格中创建了以下资源,其中包含textbox。
<Grid.Resources>
<SolidColorBrush x:Key="PhoneTextBoxEditBackgroundBrush" Color="White"/>
</Grid.Resources>这不管用。焦点背景不是白色的。
使用具有明确的白色背景而不是资源刷的模板创建样式是可行的,但对我来说太冗长了。
有什么办法可以推翻风格吗?
我看过这篇文章http://www.designersilverlight.com/2011/01/17/theme-forcing-for-windows-phone-7-silverlight/。作者说,凌驾于他的作品。
发布于 2012-04-20 15:12:05
看看这个文章..。它包含了一些您必须在app.xaml.cs中放置的代码。此代码覆盖已经加载的资源。
https://stackoverflow.com/questions/8614205
复制相似问题