【WPF】RadioButton使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/SevenGirl2017/article/details/84499712

界面展示

在这里插入图片描述

代码展示

设计界面

<!--单选框:中断任务or提前完成-->
<RadioButton Name="RadComplete" Content="提前完成" IsChecked="True" GroupName="Radreason" Foreground="White" HorizontalAlignment="Left" 
Margin="15,13,0,0"  Grid.Row="2" VerticalAlignment="Top" FontSize="12" FontWeight="Bold" Height="20" Width="94" />
<RadioButton Name="RadBreak" Content="中断任务" Foreground="White" GroupName="Radreason" HorizontalAlignment="Left"
 Margin="15,33,0,0" Grid.Row="2" VerticalAlignment="Top" FontSize="12" FontWeight="Bold" Height="18" Width="89" />

后台

属性说明

Content=“提前完成” //显示信息
IsChecked=“True” //默认选中
GroupName=“Radreason” //多个单选框设置同一GroupName,则只能多选一,实现单选效果
HorizontalAlignment=“Left” //控件位置-水平居中
VerticalAlignment=“Top” //控件位置-垂直居中
FontSize=“12” //文字大小
FontWeight=“Bold” //文字加粗显示

猜你喜欢

转载自blog.csdn.net/SevenGirl2017/article/details/84499712