2017-12-27 18 views
-1

ボタンのスタイルを変更する必要があります。問題は、ボタンがButtonRevealStyleを使用しているため何も変更できないためです。ButtonRevealStyle(静的リソース)を変更しようとしています

これは、私が使用しようとしたコードです:

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

ButtonRevealStyleを変更する方法はありますか?

あなたのButtonRevealStyleを継承する BasedOnを使用することができます

答えて

1

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

私はこのエラーを得続ける:Styleオブジェクトが私の編集した答えを参照@samueledassatti TargetTypeプロパティ –

+0

の文字列値を指定する必要があります。 – tabby

関連する問題