override WPF styles
Looking at SharpDevelop source code I found thi开发者_StackOverflow中文版s button declaration:
<Button Style="{x:Static core:GlobalStyles.ButtonStyle}"
Content="{core:Localize StartPage.StartMenu.NewCombineButton}"
Click="newSolutionClick" Margin="8,0,0,0" />
my problem is the style declaration: Style="{x:Static core:GlobalStyles.ButtonStyle}"
it prevents me from externally apply custom button style if I remove the style declaration, the external theme (stored in .xaml) file works just fine.my question: is there a way to override these specific style declarations?
Thanks a lot.
Adi BardaYou could try using BasedOn
in your style... I've never used it with an x:Static so I'm not positive if it works or the syntax, but an example would be something like:
<Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"
BasedOn={StaticResource core:GlobalStyles.ButtonStyle}">
<!-- Style Button here - If you define a Setter that already
exists in base style it will overwrite it -->
</Style>
精彩评论