我怎样才能这样做,当我点击一个按钮时,它会检查一个单选按钮?我正试图这样做,以便在点击按钮时检查radiobox
答案 0 :(得分:0)
public MainWindow()
{
// This button needs to exist on your form.
//Bind your button click event, this event will be triggered when button is clicked.
myButton.Click += myButton_Click;
}
//Once the button is clicked, now you can set the Checked property of your boolean.
void myButton_Click(object sender, RoutedEventArgs e)
{
radioButton.Checked = true;
}
答案 1 :(得分:0)
你自己试过吗?
您只需在按钮的IsChecked
- 事件处理程序中设置您的Radiobutton的Click
- 属性。
答案 2 :(得分:0)
您可以在按钮的点击事件中添加下一行:
radioButton.Checked = true;