Skip to content

Latest commit

 

History

History
53 lines (31 loc) · 3.94 KB

radiobuttons.md

File metadata and controls

53 lines (31 loc) · 3.94 KB
-api-id -api-type
T:Microsoft.UI.Xaml.Controls.RadioButtons
winrt class

Microsoft.UI.Xaml.Controls.RadioButtons

-description

Represents a control that shows a group of related options from which one can be selected.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

-remarks

For more info, design guidance, and code examples, see Radio buttons.

Example of a RadioButtons group, with one radio button selected

Use radio buttons, also called option buttons, to let users select one option from a collection of two or more mutually exclusive, but related, options. Radio buttons are always used in groups, and each option is represented by one radio button in the group.

The RadioButtons control simplifies layout, handles keyboard navigation and accessibility, and supports binding to a data source. When you use RadioButtons, you can treat your group of options as a single entity, rather than keeping track of individual RadioButton controls.

The RadioButtons control uses a content model similar to an ItemsControl. This means that you can:

Control style and template

You can modify the default Style and ControlTemplate to give the control a unique appearance. For information about modifying a control's style and template, see XAML styles. XAML also includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. Modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the XAML styles article.

The resources for this control are listed in the ThemeDictionaries section of the RadioButtons_themeresources.xaml file on GitHub. The ResourceKey value for each StaticResource references a brush and color in the Common_themeresources_any.xaml file.

-see-also

Radio buttons

-examples

Tip

For more info, design guidance, and code examples, see Radio button.

[!div class="nextstepaction"] Open the WinUI 2 Gallery app and see the RadioButton in action.

The WinUI 2 Gallery app includes interactive examples of most WinUI 2 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub.