Most of UI Elements in WPF can contain only a single child element, therefore, when you add a control to a button, an error stating that the control has a child and only one child can be added to the control is generated. To overcome this error add layouts like StackPanel inside the control and add multiple controls inside that StackPanel.
The following code snippet will cause the error mentioned above.
[XAML]
<Button Height='100'>
<RadioButton Content='Button1' />
<RadioButton>Button 2</RadioButton>>
</Button>
A StackPanel can be used inside the button to have multiple controls inside the button.
The following lines of code can be used to overcome the error.
[XAML]
<Button Height='100'>
<StackPanel Orientation='Horizontal'>
<RadioButton Content='Button1'/>
<RadioButton>Button 2</RadioButton>
</StackPanel>
</Button>
Share with