原文:潜移默化学会WPF(绚丽篇)--热烈欢迎RadioButton,改造成功,改造成ImageButton,新版导航

本样式 含有  触发器 和 动画    模板  ,多条件触发器,还有布局

本人博客园地址  http://www.cnblogs.com/Fresh-Air/

前台样式 ,我精心设计的

        <Style x:Key="RDOButton" TargetType="{x:Type RadioButton}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderThickness" Value=""/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<ControlTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="bd">
<EasingColorKeyFrame KeyTime="" Value="White"/>
<EasingColorKeyFrame KeyTime="0:0:0.3" Value="#FFAFAFAF"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Storyboard2">
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="bd">
<EasingColorKeyFrame KeyTime="" Value="#FFAFAFAF"/>
<EasingColorKeyFrame KeyTime="0:0:0.5" Value="#D3D3D3"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<BulletDecorator Background="Transparent">
<Border x:Name="bd" HorizontalAlignment="Center" Background="White" CornerRadius="">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset=""/>
<GradientStop Color="White" Offset=""/>
</LinearGradientBrush>
</Border.OpacityMask>
<ContentPresenter Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</BulletDecorator>
<ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="false">
<Setter TargetName="bd" Property="Background" Value="gray" />
</Trigger>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="bd" Property="Background" Value="{x:Null}" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Trigger.EnterActions>
<BeginStoryboard x:Name="Storyboard2_BeginStoryboard" Storyboard="{StaticResource Storyboard2}"/>
</Trigger.EnterActions>
<Setter TargetName="bd" Property="Background" Value="#FF606060" />
</Trigger> <MultiTrigger>
<MultiTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</MultiTrigger.EnterActions>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsChecked" Value="False"/>
</MultiTrigger.Conditions>
<Setter TargetName="bd" Property="Background" Value="Red" />
</MultiTrigger> </ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

调用,例如

如下:特帅

单用就是radiobutton

 <RadioButton Width="" Height="" Margin="2,5" Cursor="Hand" Name="yingyetingToolBarButton" VerticalAlignment="Top" Click="YingyetingToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True">
<StackPanel HorizontalAlignment="Center">
<Image Width="" Height="" Margin="0,5" Source="/MPCR.Client;component/Images/yingyeting.png"/>
<TextBlock><Run Text="营业厅"/></TextBlock>
</StackPanel>
</RadioButton>

这样就是一个toolbar了,自定义的

  <StackPanel Height="" Orientation="Horizontal" Focusable="True">
<StackPanel.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF727272" Offset="" />
<GradientStop Color="#FFFFFF" Offset="0.654" />
<GradientStop Color="#FEFEFE" Offset="" />
<GradientStop Color="#FFFFFFFB" Offset="0.994" />
</LinearGradientBrush>
</StackPanel.Background> <RadioButton Width="" Height="" Margin="2,5" Cursor="Hand" Name="yingyetingToolBarButton" VerticalAlignment="Top" Click="YingyetingToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True">
<StackPanel HorizontalAlignment="Center">
<Image Width="" Height="" Margin="0,5" Source="/MPCR.Client;component/Images/yingyeting.png"/>
<TextBlock><Run Text="营业厅"/></TextBlock>
</StackPanel>
</RadioButton> <RadioButton Width="" Height="" Margin="2,5" Cursor="Hand" Name="yingyechaxunToolBarButton" VerticalAlignment="Top" Click="YingyetingToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True">
<StackPanel HorizontalAlignment="Center">
<Image Width="" Height="" Margin="0,5" Source="/MPCR.Client;component/Images/yingyechaxun.png"/>
<TextBlock><Run Text="营业查询"/></TextBlock>
</StackPanel>
</RadioButton> <RadioButton Width="" Height="" Margin="2,5" Cursor="Hand" Name="jiaojiebanToolBarButton" VerticalAlignment="Top" Click="JiaojiebanToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True">
<StackPanel HorizontalAlignment="Center">
<Image Width="" Height="" Margin="0,5" Source="/MPCR.Client;component/Images/jiaojieban.png"/>
<TextBlock><Run Text="交接班"/></TextBlock>
</StackPanel>
</RadioButton> <RadioButton Width="" Height="" Cursor="Hand" Margin="2,5" Name="caipinshezhiToolBarButton" VerticalAlignment="Top" Click="CaipinshezhiToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True">
<StackPanel HorizontalAlignment="Center">
<Image Width="" Height="" Margin="0,5" Source="/MPCR.Client;component/Images/caipinshezhi.png"/>
<TextBlock><Run Text="菜品设置"/></TextBlock>
</StackPanel>
</RadioButton> <RadioButton Width="" Height="" Cursor="Hand" Margin="2,5" Name="tingshishezhiToolBarButton" VerticalAlignment="Top" Click="TingshishezhiToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True">
<StackPanel HorizontalAlignment="Center">
<Image Width="" Height="" Margin="0,5" Source="/MPCR.Client;component/Images/tingshishezhi.png"/>
<TextBlock><Run Text="厅室设置"/></TextBlock>
</StackPanel>
</RadioButton> <RadioButton Width="" Height="" Cursor="Hand" Margin="2,5" Name="xiazaiToolBarButton" VerticalAlignment="Top" Click="xiazaiToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True">
<StackPanel HorizontalAlignment="Center">
<Image Width="" Height="" Margin="0,5" Source="/MPCR.Client;component/Images/jiaojieban.png"/>
<TextBlock><Run Text="更新菜品"/></TextBlock>
</StackPanel>
</RadioButton> <RadioButton Width="" Height="" Cursor="Hand" Margin="2,5" Name="exportToolBarButton" VerticalAlignment="Top" Click="exportToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True">
<StackPanel HorizontalAlignment="Center">
<Image Width="" Height="" Margin="0,5" Source="/MPCR.Client;component/Images/MakeupMenu.png"/>
<TextBlock><Run Text="制作菜谱"/></TextBlock>
</StackPanel>
</RadioButton> </StackPanel>

个人非常喜欢,原创

效果图

最典型的应用 360 导航

自己感觉的,能做的,再和其他控件组合到一起,就帅了,是不是想到用它做个假的tab控件

潜移默化学会WPF(绚丽篇)--热烈欢迎RadioButton,改造成功,改造成ImageButton,新版导航的更多相关文章

  1. 潜移默化学会WPF(转载篇)--屏幕显示Label,鼠标移上去变成textBox

    原文:潜移默化学会WPF(转载篇)--屏幕显示Label,鼠标移上去变成textBox <Window x:Class="WpfApplication1.Window1" x ...

  2. 潜移默化学会WPF(难点控件treeview)--改造TreeView(CheckBox多选择版本),递归绑定数据

    原文:潜移默化学会WPF(难点控件treeview)--改造TreeView(CheckBox多选择版本),递归绑定数据 目前自己对treeview的感慨很多 今天先讲 面对这种 表结构的数据 的其中 ...

  3. WPF 精修篇 数据触发器

    原文:WPF 精修篇 数据触发器 数据触发器 可以使用Binding 来绑定控件 或者数据源 来触发相关动作 举栗子 <Window.Resources> <Style Target ...

  4. WPF 精修篇 动态资源

    原文:WPF 精修篇 动态资源 动态资源 使用 DynamicResource 关键字 静态 就是 StaticResource 原则上是 能用静态就用静态 动态会让前台界面压力很大~ 动态资源引用 ...

  5. 潜移默化学会WPF--值转换器

    原文:潜移默化学会WPF--值转换器 1. binding 后面的stringFormat的写法----连接字符串 <TextBlock Text="{Binding Path=Qty ...

  6. WPF 精修篇 属性触发器

    原文:WPF 精修篇 属性触发器 属性触发器是通过  某个条件触发改变属性 通过无代码实现功能 <Style TargetType="{x:Type Label}"> ...

  7. WPF 精修篇 样式继承

    原文:WPF 精修篇 样式继承 这个 是新知识 样式可以继承 <Style x:Key="TextBlockStyleBase" TargetType="{x:Ty ...

  8. WPF 精修篇 自定义控件

    原文:WPF 精修篇 自定义控件 自定义控件 因为没有办法对界面可视化编辑 所以用来很少 现在实现的是 自定义控件的 自定义属性 和自定义方法 用VS 创建自定义控件后 会自动创建 Themes 文件 ...

  9. WPF 精修篇 用户控件

    原文:WPF 精修篇 用户控件 增加用户控件 数据绑定还是用依赖属性 使用的事件 就委托注册一下 public delegate void ButtonClick(object b,EventArgs ...

随机推荐

  1. PatentTips - Highly-available OSPF routing protocol

    BACKGROUND OF THE INVENTION FIG. 1A is a simplified block diagram schematically representing a typic ...

  2. 事件处理之一:两种方式:监听器与回调 分类: H1_ANDROID 2013-10-31 10:26 3250人阅读 评论(0) 收藏

    Android组件的事件处理有2种方式: 1.基于监听器的事件处理方式:先定义组件,然后为组件设定监听器. 详见http://blog.csdn.net/jediael_lu/article/deta ...

  3. [Compose] 10. Capture Side Effects in a Task

    We examine the data structure Task, see some constructors, familiar methods, and finally how it capt ...

  4. 【转】A* A星 算法 C语言 实现代码

    http://blog.csdn.net/shanshanpt/article/details/8977512 关于A*算法,很早就想写点什么,可是貌似天天在忙活着什么,可事实又没有做什么,真是浮躁啊 ...

  5. SpringMVC拦截器-路径语法-略坑

    项目中遇到一种场景,登录拦截器需要拦截.html后缀等动态请求,但是发现语法不对头.    <mvc:interceptors>      <mvc:interceptor> ...

  6. 开源 RISC-V 架构正在改变 IoT 处理器的游戏规则

    by Paddy McWilliams, Director of Product Marketing, CEVA   在过去的十年里,开源软件已经成为了科技世界最大的催化剂.现在开源的力量带来了自由发 ...

  7. Silverlight三维透视+倒影效果

    原文:Silverlight三维透视+倒影效果 知识概要: 1.使用2D内容创建3D体验,了解图像的PlaneProjection属性,具体内容读者自己查看文档. 2.Silverlight图形图形的 ...

  8. javaScript实现图片滚动及一个普通图片轮播的代码

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. ppt转flash kindeditor上传视频全屏问题

    最近要增加页面的ppt显示功能,于是考虑把ppt转成flash,在网上搜到了ispingfree,链接: https://pan.baidu.com/s/1QZzx6qmdsnwzWCuULXzUOw ...

  10. MKNetWorkKit的使用(1)

    在整个程序中只有一个全局队列 MKNetWorkKit中主要有两个类,MKNetworkEngine和 MKNetworkOperation,MKNetworkOperation就是一个操作,是NSO ...