0
ユーザーがマウスの上を移動すると、設定したイメージの背景が変わるボタンスタイルにしたいのですが、このスタイルを使用するとテキスト(コンテンツ)も削除されますカスタムテンプレートを使用すると、ボタンからテキストが削除されます
ここは、私が
<Style TargetType="{x:Type Button}" x:Key="StartButton_Style">
<Setter Property="Background">
<!-- Background image (dark one)-->
<Setter.Value>
<ImageBrush ImageSource="C:\Users\yosi1\OneDrive\מסמכים\Visual Studio 2017\Projects\Classic Story Launcher\Resources\Start_Button_Nornal.png"/>
</Setter.Value>
</Setter>
<Setter Property="FontFamily" Value="Candara"/>
<Setter Property="FontSize" Value="40"/>
<Setter Property="Foreground" Value="#FFA48B60"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<!-- Triggers an event when the user hovers the mouse over the button-->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<!-- Chagnes the background images to notify the user that his mouse is over the button -->
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="C:\Users\yosi1\OneDrive\מסמכים\Visual Studio 2017\Projects\Classic Story Launcher\Resources\Start_Button_Click.png"/>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
使用スタイリングされており、ここでスタイリングを使用して、ボタン要素である
<Button Grid.Column="2" Content="START" Margin="0,34,0,0" Style="{StaticResource StartButton_Style}"/>
をグリッドを追加し、それにボーダーを入れて、ボーダーの後(ボーダーの上に)申し訳ありません<のContentPresenter /> – shadow32