Showing posts with label Gotcha Radio Button groups. Show all posts
Showing posts with label Gotcha Radio Button groups. Show all posts

Wednesday, October 27, 2010

Radio Button groups

  • There is no Tab Group box in the toolbox
    • Solution: use GroupName in the .xaml file
    • eg.
            <RadioButton Content="Male" Height="72" HorizontalAlignment="Left" Margin="293,102,0,0" Name="maleRadioButton" VerticalAlignment="Top" Checked="maleRadioButton_Checked"
                         GroupName="MyRadioBtnGroup"/>
            <RadioButton Content="Female" Height="72" HorizontalAlignment="Left" Margin="292,177,0,0" Name="femaleRadioButton" VerticalAlignment="Top" Checked="femaleRadioButton_Checked" 
                         GroupName="MyRadioBtnGroup"/>

The traditional way of dealing with multiple radio buttons, with "one checked" behaviour, is to put the Radio Buttons in a group box.  The Toolbox in the Windows Phone 7 Toolkit does not have a group box.


I was trying to do it programatically, and could not find a simple way to programatically set the state of the Radio Button, trying to use SetValue required a DependencyProperty...