XAML
<GroupBox Name="FirstGroupBox" Header="1st" Margin="10,0,5,0" Height="auto" Width="auto" > <RadioButton x:Name="gRBuResearcher1" Content ="Researcher" Click="gRBuResearcher1_Click" /> <RadioButton x:Name="gRBuScientist1" Content="Scientist" Click="gRBuScientist1_Click" /> <RadioButton x:Name="gRBuMedic1" Content="Medic" Click="gRBuMedic1_Click" /> </GroupBox>
XAML.CS
using System.Windows.Controls; foreach (var child in FirstGroupBox.Children) { if (child.Content is "Scientist") { RadioButton.IsChecked = true; } }
This does not work. How do I set gRBuScientist1 to true?