We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Platform : WPF
|
Category : Layouts

When I try to add multiple controls to a button it shows an error, how do I add multiple controls to a button?

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.

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.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.