国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

XAML中Button重繪為圓形的方法技巧

2019-10-26 17:05:46
字體:
來源:轉載
供稿:網友
在用XAML布局的時候,有時候為了使界面Metro化,有些Button要使用圓形代替默認的長方形。以下的Button樣式可以解決這個問題,可以根據自己的需要再加以修改。當然如果你熟悉Bland的話可以直接使用它來繪制你需要的樣式,但是貼代碼是否更快一點呢?

復制代碼
代碼如下:
<Style x:Key="btnNext" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="rectangle">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Thickness>-3</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal"/>
<VisualState x:Name="Disabled"/>
<VisualState x:Name="MouseOver"/>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle x:Name="rectangle" RadiusY="25" RadiusX="25" Stroke="Blue" StrokeThickness="4">
</Rectangle>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Margin" Value="5"/>
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="50"/>
<Setter Property="FontSize" Value="120"/>
<Setter Property="Foreground" Value="White"/>
</Style>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 五莲县| 威远县| 香港| 泌阳县| 清徐县| 兴仁县| 大冶市| 宜都市| 长葛市| 高安市| 长沙市| 汉源县| 孟津县| 平原县| 兖州市| 清涧县| 离岛区| 平山县| 襄垣县| 南通市| 郑州市| 涟水县| 游戏| 特克斯县| 辽源市| 杭锦旗| 定襄县| 柞水县| 汕尾市| 枞阳县| 大名县| 江都市| 收藏| 穆棱市| 乌恰县| 梅州市| 通海县| 敦化市| 桦川县| 岫岩| 察雅县|