XAML中Button重绘为圆形
来源:互联网 发布:java培训班北京 编辑:程序博客网 时间:2024/06/05 02:51
在用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>
<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- XAML中Button重绘为圆形
- 圆形button设置点击区域为圆形
- android 设置Button为圆形按钮
- UWP xaml 圆形头像
- 圆形Button
- 圆形button
- mfc button 重绘
- 重绘Button控件
- Button控件的重绘
- Button控件的重绘
- Button 按钮的重绘
- 圆形的Button
- ILSpy中baml转化为xaml的改进
- ILSpy中baml转化为xaml的改进(二)
- ILSpy中baml转化为xaml的改进(三)
- ILSpy中baml转化为xaml的改进(四)
- ILSpy中baml转化为xaml的改进(五)
- 在XAML代码中为节点树安装事件监听器
- VMware Workstation 9.0.1 Bulid 894247安装、注册指南
- ASP.NET 4.0 Webform传统开发模式下如何压缩css, js
- Csharp:The .dat File using BinaryReader and BinaryWriter Convert to DataTable
- ASP.Net 实现伪静态方法及意义
- 进程间通信小结
- XAML中Button重绘为圆形
- Android dialog自定义样式
- 【译】《Pro ASP.NET MVC4 4th Edition》系列(四)
- 纯Jquery实现年月选择,并且根据当前月份划分周次
- KDD2012参会小结
- ASP.NET验证控件总结
- 04下gedit查看txt中文乱码解决办法
- DataTable中数据记录的排序、检索、合并、分页、统计
- ubuntu 12.04下gedit查看txt中文乱码解决办法