Clyde Eisenbeis

Clyde Eisenbeis

  • 1.7k
  • 79
  • 13.5k

If 1st RadioButton is selected how do I block 2nd RadioButton?

Dec 1 2024 12:43 AM

I have two columns of Radio Buttons => snipboard.io/Xy3IQr.jpg.

xaml

<StackPanel Orientation="Vertical">
    <RadioButton x:Name="gRBuResearcher1" Click="gRBuResearcher1_Click" >
        <Label Content="Researcher"/>
    </RadioButton>
    <RadioButton x:Name="gRBuScientist1" Click="gRBuScientist1_Click" >
        <Label Content="Scientist"/>
    </RadioButton>
    <RadioButton x:Name="gRBuMedic1" Click="gRBuMedic1_Click" >
        <Label Content="Medic">
    </RadioButton>
    <RadioButton x:Name="gRBuDispatcher1" Click="gRBuDispatcher1_Click" >
        <Label Content="Dispatcher"/>
    </RadioButton>
</StackPanel>
...
<StackPanel Orientation="Vertical">
    <RadioButton x:Name="gRBuResearcher3" Click="gRBuResearcher3_Click" >
        <Label Content="Researcher"/>
    </RadioButton>
    <RadioButton x:Name="gRBuScientist3" Click="gRBuScientist3_Click" >
        <Label Content="Scientist"/>
    </RadioButton>
    <RadioButton x:Name="gRBuMedic3" Click="gRBuMedic3_Click" >
        <Label Content="Medic"/>
    </RadioButton>
    <RadioButton x:Name="gRBuDispatcher3" Click="gRBuDispatcher3_Click" >
        <Label Content="Dispatcher"/>
    </RadioButton>
</StackPanel>

xaml.cs

//------------------------------
private void gRBuResearcher1_Click(object sender, RoutedEventArgs e)
{
    gstCharacter1 = "Researcher";
}//gRBuResearcher1_Click
//------------------------------
//------------------------------
private void gRBuScientist1_Click(object sender, RoutedEventArgs e)
{
    gstCharacter1 = "Scientist";
}//gRBuScientist1_Click
//------------------------------
//------------------------------
private void gRBuMedic1_Click(object sender, RoutedEventArgs e)
{
    gstCharacter1 = "Medic";
}//gRBuMedic1_Click
//------------------------------
//------------------------------
private void gRBuDispatcher1_Click(object sender, RoutedEventArgs e)
{
    gstCharacter1 = "Dispatcher";
}//gRBuDispatcher1_Click
//------------------------------
...
//------------------------------
private void gRBuResearcher2_Click(object sender, RoutedEventArgs e)
{
    gstCharacter2 = "Researcher";
}//gRBuResearcher2_Click
//------------------------------
//------------------------------
private void gRBuScientist2_Click(object sender, RoutedEventArgs e)
{
    gstCharacter2 = "Scientist";
}//gRBuScientist2_Click
//------------------------------
//------------------------------
private void gRBuMedic2_Click(object sender, RoutedEventArgs e)
{
    gstCharacter2 = "Medic";
}//gRBuMedic2_Click
//------------------------------
//------------------------------
private void gRBuDispatcher2_Click(object sender, RoutedEventArgs e)
{
    gstCharacter2 = "Dispatcher";
}//gRBuDispatcher2_Click
//------------------------------

If "Researcher" is selected in the 1st col, how do I block "Researcher" from being selected in the 2nd col?


Answers (1)