Wednesday, June 24, 2009

Missing Silverlight Radio Button Group Box

If you're looking for the radio button group box in Silverlight, you won't find one. Even better than the group box is the stackpanel. Simply add you your radio buttons to a stackpanel and iterate through the stackpanels childen to see which one is checked.


//XML CODE










//C# CODE
private void RadioButton_Click(object sender, RoutedEventArgs e)
{
foreach (RadioButton button in this.RadioButtons.Children)
{
MessageBox.Show(button.Content + " "+ button.IsChecked.ToString());
}
}

No comments:

Post a Comment