



An Image control (read more about those later) is used to display an image for each choice. For thisĮxample, I have changed the text color to match the choice. Since we now take control of the text using a TextBlock control, this also allows us to format the text in any way we want to. For each RadioButton, we have a WrapPanel with an image and a piece of text Markup-wise, this example gets a bit heavy, but the concept is pretty simple. You can use any type of control inside of it, as we'll see in the next example: Text, like I did in the example above, WPF will put it inside a TextBlock control and display it, but this is just a shortcut to make things easier for The RadioButton inherits from the ContentControl class, which means that it can take custom content and display next to it. Without this, only one selection forĪll six radio buttons would be possible. With the GroupName property set on each of the radio buttons, a selection can now be made for each of the two groups.

To specify which radio buttons belong together. Groups of radio buttons, each with their own, individual selection? This is what the GroupName property comes into play, which allows you If you try running the example above, you will see that, as promised, only one RadioButton can be checked at the same time. This is also the property you would want to use from Code-behind to check if a RadioButton is checked or not. Property on the last RadioButton, which the user can change simply by clicking on one of the other radio buttons. We define a default option by using the IsChecked Īll we do is add a Label with a question, and then three radio buttons, each with a possible answer. You can achieve the sameĮffect, using less space, with the ComboBox control, but a set of radio buttons tend to give the user a better overview of the options they have. The RadioButton control allows you to give your user a list of possible options, with only one of them selected at the same time.
