Reputation: 249
I'm trying to make a GroupBox with a few (radio)buttons in it. But in the samples i'm using checkbox.
<GroupBox Header="Aðgerðir" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="270,0,0,178" Height="106" Width="176">
<CheckBox Content="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<CheckBox Content="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
</GroupBox>
The above does not work and visual studio says "Invalid Markup".
This here works fine though
<GroupBox Header="Aðgerðir" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="270,0,0,178" Height="106" Width="176">
<CheckBox Content="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</GroupBox>
I don't get it. It says "Content can only be set once" if i run the debugger, but erasing the Content part of the checkbox seems to have no effect.
Upvotes: 2
Views: 6066
Reputation: 13620
The content of the GroupBox can only be set once, meaning that it can only have a single control inside it. If you want to two radio button, place them in a stack panel or a grid.
<GroupBox Header="Aðgerðir" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="270,0,0,178" Height="106" Width="176">
<StackPanel>
<CheckBox Content="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<CheckBox Content="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
</StackPanel>
</GroupBox>
Upvotes: 8