Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to set Data property for button style in wpf?
    text
    copied!<p>In this example property:</p> <p><code>Data= M150.655, 39.109L10.407, 53.785L0.602, 1.309l158.026-0.806L150.655, 39.109z</code></p> <p>How does this <code>Data</code> property work and use these 5 values?</p> <pre><code>&lt;Style x:Key="ButtonStyler" TargetType="{x:Type Button}"&gt; &lt;Setter Property="Cursor" Value="Hand" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type Button}"&gt; &lt;Grid&gt; &lt;Path x:Name="ButtonBG" Fill="Lime" Stroke="#000000" StrokeThickness="3" Data="M150.655,39.109L10.407,53.785L0.602,1.309l158.026-0.806L150.655,39.109z" /&gt; &lt;ContentPresenter x:Name="ContentSite" Margin="20,10,20,10" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" TextBlock.FontFamily="Comic Sans MS" TextBlock.FontSize="20"&gt; &lt;ContentPresenter.RenderTransform&gt; &lt;TransformGroup&gt; &lt;TransformGroup.Children&gt; &lt;TransformCollection&gt; &lt;RotateTransform Angle="-5" /&gt; &lt;ScaleTransform ScaleX="1.5" ScaleY="1" /&gt; &lt;TranslateTransform X="-35" Y="0" /&gt; &lt;/TransformCollection&gt; &lt;/TransformGroup.Children&gt; &lt;/TransformGroup&gt; &lt;/ContentPresenter.RenderTransform&gt; &lt;/ContentPresenter&gt; &lt;/Grid&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="IsMouseOver" Value="true"&gt; &lt;Setter Property="Path.Fill" Value="yellow" TargetName="ButtonBG" /&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsPressed" Value="true"&gt; &lt;Setter Property="Path.Fill" Value="lime" TargetName="ButtonBG" /&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="IsMouseOver" Value="true"&gt; &lt;Setter Property="RenderTransform"&gt; &lt;Setter.Value&gt; &lt;TransformGroup&gt; &lt;TransformGroup.Children&gt; &lt;TransformCollection&gt; &lt;RotateTransform Angle="-5" /&gt; &lt;TranslateTransform X="-5" Y="0" /&gt; &lt;/TransformCollection&gt; &lt;/TransformGroup.Children&gt; &lt;/TransformGroup&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsPressed" Value="true"&gt; &lt;Setter Property="RenderTransform"&gt; &lt;Setter.Value&gt; &lt;TransformGroup&gt; &lt;TransformGroup.Children&gt; &lt;TransformCollection&gt; &lt;RotateTransform Angle="-5" /&gt; &lt;TranslateTransform X="-5" Y="5" /&gt; &lt;/TransformCollection&gt; &lt;/TransformGroup.Children&gt; &lt;/TransformGroup&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload