原文:潜移默化学会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. 【27.91%】【codeforces 734E】Anton and Tree

    time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  2. HDU 1045 Fire Net(行列匹配变形+缩点建图)

    题意:n*n的棋盘上放置房子.同一方同一列不能有两个,除非他们之间被墙隔开,这种话. 把原始图分别按行和列缩点 建图:横竖分区.先看每一列.同一列相连的空地同一时候看成一个点,显然这种区域不可以同一时 ...

  3. 【Nutch2.2.1基础教程之3】Nutch2.2.1配置文件 分类: H3_NUTCH 2014-08-18 16:33 1376人阅读 评论(0) 收藏

    nutch-site.xml 在nutch2.2.1中,有两份配置文件:nutch-default.xml与nutch-site.xml. 其中前者是nutch自带的默认属性,一般情况下不要修改. 如 ...

  4. MinGW和MSYS项目是在一起的(翻译官网)

    翻译MinGW官网的首页,首页描述了MinGW和MSYS的基本情况. Home of the MinGW and MSYS Projects(我才知道,MinGW和MSYS项目是在一起的 -_-!) ...

  5. HTML5 canvas 指针时钟

    <!doctype html> <html> <head></head> <body> <canvas id="> 您 ...

  6. [Angular Directive] 1. Write an Angular Directive

    Angular 2 Directives allow you manipulate elements by adding custom behaviors through attributes. Th ...

  7. Android 开发--CMakeList调用本地so文件

    这里写代码片Android开发常常遇到Java调用so文件的情况,本文介绍一下Google最近新推出的应用在android studio中的方法–cmakelist.txt格式调用. so文件分为jn ...

  8. sdo_geometry 转 st_geometry

    CREATE OR REPLACE FUNCTION sdo2sde(geo SDO_GEOMETRY) RETURN st_geometry IS lx number; --类型 (点.线.面) c ...

  9. 二维高斯滤波器(gauss filter)的实现

    我们以一个二维矩阵表示二元高斯滤波器,显然此二维矩阵的具体形式仅于其形状(shape)有关: def gauss_filter(kernel_shape): 为实现二维高斯滤波器,需要首先定义二元高斯 ...

  10. echarts改变颜色属性的demo

    一:柱状图改变颜色 图片.png 代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8&qu ...