代码之家  ›  专栏  ›  技术社区  ›  Benny F

替代WPF样式

  •  0
  • Benny F  · 技术社区  · 16 年前

    查看sharpdevelope源代码,我发现以下按钮声明:

    <Button Style="{x:Static core:GlobalStyles.ButtonStyle}"
    

    Content="{core:Localize StartPage.StartMenu.NewCombineButton}" Click="newSolutionClick" Margin="8,0,0,0" />

    我的问题是风格宣言: Style=“{x:静态核心:GlobalStyles.ButtonStyle}"
    它阻止我从外部应用自定义按钮样式

    谢谢。
    阿迪巴达

    1 回复  |  直到 15 年前
        1
  •  2
  •   Rachel    16 年前

    你可以试着用 BasedOn 以你的风格。。。我从未将它与x:Static一起使用过,因此我不确定它是否有效或语法正确,但示例如下:

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