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...






1 comment:

  1. Check out this link too for more details on Radio Button control in Windows Phone 7 Development...
    http://www.mindstick.com/Articles/a6d78097-46a3-4392-856e-640ce106b959/?RadioButton%20Control%20in%20Windows%207%20Phone%20Development

    ReplyDelete