locked
Groupbox problems - it won't let me add more than 1 radiobutton RRS feed

  • Question

  • Afternoon!

    I need some help - the problem I ran into seems weird to me!

    I'm trying to create a Sketchflow prototype of a wizard (in WPF) and need to put a groupbox with two radio bottons on one dialog box. I know that the groupbox isn't part of the SketchStyles, but after I change the font -  it works.  Next, I added in a SketchStyle radio button, but when I tried to insert the second radio button - It would't do it. 

    The way I got it to work (kinda) was to not include the second radio button in the groupbox. Its on the LayoutRoot level. Visually it looks fine, but I don't understand why I can't have 2 radio buttons in a groupbox.

    Can anyone explain to me - either what I'm doing wrong - or - why this isn't allowed. 

    Thanks so much!

    Elizabeth 
    Wednesday, December 30, 2009 7:26 PM

All replies

  • Hi eteffner

    Will this help (I just did it in a WPF sketchflow project)

    1- add 4 radio buttons to the art board
    2- select them all
    3 - rightclick them in the objects panel and select group into boarder
    4- try it out

    I hope I understand you intentions, I don't speek english great that.

    Thursday, December 31, 2009 5:54 PM
  • I think I figured out the problem.

    First, I think that this is something that has changed from earliear versions of Blend. It seems to me that it used to be that when you added a GroupBox to your project that you could easily add items to it like you want to because the GroupBox automatically came with a container (like a grid) to put multiple children in. Maybe I'm remembering wrong, but now GroupBox is added without a container by default.

    GroupBox is a Headered control that can only contain one child element. when you tried to add the second RadioButton, it added it, but in place of the first.  What you need to do is first add some Panel as a container. Use a Grid, StackPanel, DockPanel, etc, for whatever suites you layout needs for your RadioButtons. This panel becomes the one and only child of the GroupBox but now you can nest as many child elements as you would like inside the GroupBox.  Here is how my attempt looks in xaml.

    <GroupBox HorizontalAlignment="Left" VerticalAlignment="Top" Header="GroupBox">
         <StackPanel Height="100">
    	<RadioButton Content="RadioButton"/>
    	<RadioButton Content="RadioButton"/>
    	<RadioButton Content="RadioButton"/>
         </StackPanel>
    </GroupBox>

    Hope that clears up the issue for you.  That was a good question.

    Regards,
    Jode
    • Edited by JodeAllen Thursday, December 31, 2009 6:32 PM fix formatting
    • Proposed as answer by JodeAllen Thursday, December 31, 2009 6:33 PM
    Thursday, December 31, 2009 6:32 PM
  • Hi again
    I thought my method might break if I added a second group of radio buttons to the grid outside the bioarder of the first group.
    tried it.
    It still works!

    mike
    Thursday, December 31, 2009 7:16 PM