开发者

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 Barda


You 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜