900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > WPF 自定义开关按钮实现

WPF 自定义开关按钮实现

时间:2020-02-27 21:17:43

相关推荐

WPF 自定义开关按钮实现

效果如下:

分别有四种用法:

第一种 文字在右边第二种 文字在中间第三种 文字无第四种 一组单选类型实现思路看代码吧,还不够很完美...

一、引用方法:

<StackPanelGrid.Row="2"Margin="0,50,0,0"Orientation="Horizontal"><YOI:USwitchButtonWidth="70"Height="30"Margin="10"ActiveBackground="{DynamicResource PrimaryBlueColor}"ActiveForeground="{DynamicResource TextSecundaryColor}"ContentFalse="关闭"ContentTrue="开启"Cursor="Hand"FontSize="14"InactiveBackground="{DynamicResource TextWhiteColor}"SwitchBorderRadius="15"SwitchContentTemplate="Right" /><YOI:USwitchButtonWidth="80"Height="30"Margin="50,10,10,10"ActiveBackground="{DynamicResource PrimaryBlueColor}"ActiveForeground="{DynamicResource TextWhiteColor}"ContentFalse="关闭"ContentTrue="开启"FontSize="14"Foreground="{DynamicResource TextSecundaryColor}"InactiveBackground="{DynamicResource TextWhiteColor}"SwitchBorderRadius="15"SwitchContentTemplate="Middle" /><YOI:USwitchButtonWidth="70"Height="30"Margin="10"ActiveBackground="{DynamicResource PrimaryBlueColor}"ActiveForeground="{DynamicResource PrimaryGreen}"FontSize="14"Foreground="{DynamicResource TextSecundaryColor}"InactiveBackground="{DynamicResource TextWhiteColor}"SwitchBorderRadius="15" /><StackPanelGrid.Row="2"Margin="0,50,0,0"Orientation="Vertical"><YOI:USwitchButtonWidth="70"Height="30"Margin="10"ActiveBackground="{DynamicResource PrimaryBlueColor}"ActiveForeground="{DynamicResource PrimaryGreen}"FontSize="14"Foreground="{DynamicResource TextSecundaryColor}"InactiveBackground="{DynamicResource TextWhiteColor}"SwitchBorderRadius="15"SwitchType="1" /><YOI:USwitchButtonWidth="70"Height="30"Margin="10"ActiveBackground="{DynamicResource PrimaryBlueColor}"ActiveForeground="{DynamicResource PrimaryGreen}"FontSize="14"Foreground="{DynamicResource TextSecundaryColor}"InactiveBackground="{DynamicResource TextWhiteColor}"SwitchBorderRadius="15"SwitchType="1" /></StackPanel>

二、语雀笔记:

/docs/share/a26bfbb5-5c40-4d4b-9daa-06b53da041b0?# 《WPF 自定义开关按钮实现》

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。