在這個例子屬性:如何在wpf中設置按鈕樣式的Data屬性?
Data= M150.655, 39.109L10.407, 53.785L0.602, 1.309l158.026-0.806L150.655, 39.109z
請問這個Data
性質的工作,並利用這些5個值?
<Style x:Key="ButtonStyler"
TargetType="{x:Type Button}">
<Setter Property="Cursor"
Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type Button}">
<Grid>
<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" />
<ContentPresenter x:Name="ContentSite"
Margin="20,10,20,10"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
TextBlock.FontFamily="Comic Sans MS"
TextBlock.FontSize="20">
<ContentPresenter.RenderTransform>
<TransformGroup>
<TransformGroup.Children>
<TransformCollection>
<RotateTransform Angle="-5" />
<ScaleTransform ScaleX="1.5"
ScaleY="1" />
<TranslateTransform X="-35"
Y="0" />
</TransformCollection>
</TransformGroup.Children>
</TransformGroup>
</ContentPresenter.RenderTransform>
</ContentPresenter>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="true">
<Setter Property="Path.Fill"
Value="yellow"
TargetName="ButtonBG" />
</Trigger>
<Trigger Property="IsPressed"
Value="true">
<Setter Property="Path.Fill"
Value="lime"
TargetName="ButtonBG" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="true">
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<TransformGroup.Children>
<TransformCollection>
<RotateTransform Angle="-5" />
<TranslateTransform X="-5"
Y="0" />
</TransformCollection>
</TransformGroup.Children>
</TransformGroup>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed"
Value="true">
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<TransformGroup.Children>
<TransformCollection>
<RotateTransform Angle="-5" />
<TranslateTransform X="-5"
Y="5" />
</TransformCollection>
</TransformGroup.Children>
</TransformGroup>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
此MSDN幫助路徑geometry..i想了解一下在數據屬性 – 2009-09-15 06:29:57
更新回答這些5個參數... – kiwipom 2009-09-15 06:52:02