人员1
人员2
人员3
string s1;
private void Group_Checked(object sender,RoutedEventArgs e)
{
RadioButton r=e.Source as RadioButton;
if(r.IsChecked==true)
s1.r.Content.ToString();
}
对于这段代码,我有好几个问题想问:
1.RadioButton.Checked这里,没有指定是哪个RadioButton,执行起来怎么知道是哪个?
2.RadioButton r=e.Source as RadioButton这是什么意思?执行这句后,r表示哪个RadioButton?
是额。2: Source 就是 表示该事件的触发源,所以会是object 类型的。 as 就是转换成对应的对象。你可以在xaml中 设置name,在后台进行区分。