属性说明
Content=“radioButton” //显示信息
IsChecked=“True” //默认选中
GroupName=“carSize” //多个单选框设置同一GroupName,则只能多选一,实现单选效果
HorizontalAlignment=“Left” //控件位置-水平居中
VerticalAlignment=“Top” //控件位置-垂直居中
FontSize=“12” //文字大小
FontWeight=“Bold” //文字加粗显示
选中时改变颜色
private void CarSizeBig_Checked(object sender, RoutedEventArgs e) { carSizeBig.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF71FFF5")); carSizeMiddle.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF")); carSizeSmall.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF")); } private void CarSizeMiddle_Checked(object sender, RoutedEventArgs e) { carSizeBig.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF")); carSizeMiddle.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF71FFF5")); carSizeSmall.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF")); } private void CarSizeSmall_Checked(object sender, RoutedEventArgs e) { carSizeBig.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF")); carSizeMiddle.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF")); carSizeSmall.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF71FFF5")); }