8,735
社区成员
发帖
与我相关
我的任务
分享
<ControlTemplate TargetType="Button">
<Grid>
<Image Width={TemplateBinding Width} Height={TemplateBinding Height} .../>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
<Button Content="Test" Width="100" Height="100" Margin="128,128,172,72">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Duration="0" To="#FFEB8686" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="regularPolygon" d:IsOptimized="True"/>
<ColorAnimation Duration="0" To="#F9A95454" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="regularPolygon" d:IsOptimized="True"/>
<ColorAnimation Duration="0" To="#E5A17070" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="regularPolygon" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed"/>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ed:RegularPolygon x:Name="regularPolygon" Stroke="Red" InnerRadius="0.47211" PointCount="5" Stretch="Fill" UseLayoutRounding="False">
<ed:RegularPolygon.Fill>
<LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
<GradientStop Color="#FFFFFFFF" Offset="0"/>
<GradientStop Color="#F9FFFFFF" Offset="0.375"/>
<GradientStop Color="#E5FFFFFF" Offset="0.625"/>
<GradientStop Color="#C6FFFFFF" Offset="1"/>
</LinearGradientBrush>
</ed:RegularPolygon.Fill>
</ed:RegularPolygon>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Button.Template>
</Button>