潜移默化学会WPF(绚丽篇)--RadioButton wpf radiobutton 组

来源:博客园作者:茗洋芳竹

前台样式 ,我精心设计的 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= 0 /

前台样式 ,我精心设计的

<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="0"/> <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="0" 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="0" 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="5"> <Border.OpacityMask> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="Black" Offset="0"/> <GradientStop Color="White" Offset="1"/> </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="80" Height="70" Margin="2,5" Cursor="Hand" Name="yingyetingToolBarButton" VerticalAlignment="Top" Click="YingyetingToolBarButton_Click" Style="{DynamicResource RDOButton}" SnapsToDevicePixels="True"> <StackPanel HorizontalAlignment="Center"> <Image Width="35" Height="35" Margin="0,5" Source="/MPCR.Client;component/Images/yingyeting.png"/> <TextBlock><Run Text="营业厅"/></TextBlock> </StackPanel> </RadioButton>  这样就是一个toolbar了,自定义的

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

效果图

    本文来自茗洋芳竹的博客,

  

爱华网本文地址 » http://www.aihuau.com/a/25101011/79227.html

更多阅读

转载 转 崔玉涛等其他医生微博整理咳嗽篇 崔玉涛小儿咳嗽

原文地址:[转]崔玉涛等其他医生微博整理(咳嗽篇)作者: 可乐泡泡今天又整理了一下咳嗽篇。给大家推荐几个很有名的医生的微博:@崔玉涛 @睦家药师冀连梅 @儿科专家夏凯莉@儿科专家夏凯莉 @和睦家王惠民:其实好的医生很多,不只这些,这些医生给

自学WPF--第五课渐变画刷 wpf path 背景画刷

渐变画刷是指进行颜色渐变的一种绘图方式渐变画刷分为两类:1,LinearGradientBrush(线性渐变)2,RadialGradienBrush(放射形渐变)线性渐变:线性渐变是指一种颜色沿直线方式过渡到另一种颜色的渐变.属性有以下几个:StartPoint(设置渐变起始

有关学会感恩的作文 学会感恩作文演讲稿

这篇文章起源初中作文,新一年的新欲望,我也要发表作文学会感恩  全文叙事集中,不枝不蔓,语言朴实流畅,感情真挚感人.走在人生的途径,你感到你快活无比。感恩父母,是他们给了你性命,你,我的友人。我感恩父母,是他们抚育咱们成长,母爱 

马尔代夫游记第三篇陶醉绚丽岛 马尔代夫游记蚂蜂窝

第三篇 陶醉绚丽岛经过千辛万苦,历时15个小时,终于在北京时间20日早5:40、马代时间20日早2:40登上位于马尔代夫南部的绚丽岛。天很黑,看不见岛上的景致,从码头通向酒店大堂的路是建在海上大约20米长的木制长廊。酒店大堂的前台象一艘大

转载 黄金剩女必须学会的6种女性特质 博客里转载的一篇女性

原文地址:黄金剩女必须学会的6种女性特质作者:马君近来颇受关注的未来二十年将成为剩男时代的话题离我们多少还有点距离,但剩女已经是大家耳熟能详的一个独特称谓了。抛开工作需要、住房压力等客观因素的影响,大量剩女的出现恐怕与这个

声明:《潜移默化学会WPF(绚丽篇)--RadioButton wpf radiobutton 组》为网友忽而令夏分享!如侵犯到您的合法权益请联系我们删除