【问题标题】:Trying to change ButtonRevealStyle (static resource)尝试更改 ButtonRevealStyle(静态资源)
【发布时间】:2017-12-27 13:00:13
【问题描述】:

我需要对按钮的样式进行一些更改,问题是,由于该按钮使用的是ButtonRevealStyle,所以我无法更改任何内容。

这是我尝试使用的代码:

<Button x:Name="Button1" Style="{StaticResource ButtonRevealStyle}">
<Button.Resources>
    <SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="Transparent" />
</Button.Resources>

有没有办法改变 ButtonRevealStyle?

【问题讨论】:

    标签: windows xaml button uwp


    【解决方案1】:

    您可以使用BasedOn 继承您的ButtonRevealStyle:

    <Button x:Name="Button1">
     <Button.Style>
      <Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
          <Setter Property="Background" Value="Yellow"/>
           ...
      </Style>
     </Button.Style>
    <Button.Resources>
        <SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="Transparent" />
    </Button.Resources>
    

    【讨论】:

    • 我不断收到此错误:样式对象必须为 TargetType 属性指定字符串值
    猜你喜欢
    • 2020-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多