#857 – Manually Grouping RadioButtons

RadioButtons are normally automatically grouped, based on panel control in which they are located in.  All RadioButtons within a particular panel are considered part of the same group–which means that exactly one RadioButton at a time can be selected.

You can, however, manually control which RadioButtons are considered to be part of a group, regardless of the parent panel in which they are located.  You specify membership in a group using the GroupName property.  GroupName can be set to any string value.  RadioButton instances having the same value for GroupName are considered part of the same group.

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <RadioButton Content="Extrovert"
                     GroupName="EI"/>
        <RadioButton Grid.Row="1" Content="Introvert"
                     GroupName="EI"/>

        <RadioButton Grid.Column="1" Content="Sensing"
                     GroupName="SN"/>
        <RadioButton Grid.Row="1" Grid.Column="1" Content="Intuition"
                     GroupName="SN"/>

        <RadioButton Grid.Column="2" Content="Thinking"
                     GroupName="TF"/>
        <RadioButton Grid.Row="1" Grid.Column="2" Content="Feeling"
                     GroupName="TF"/>
    </Grid>

857-001

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

One Response to #857 – Manually Grouping RadioButtons

  1. Pingback: #857 – Manually Grouping RadioButtons | Program In .NET

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: