diff --git a/XamlControlsGallery/Assets/RadioButtons.png b/XamlControlsGallery/Assets/RadioButtons.png new file mode 100644 index 000000000..c22831144 Binary files /dev/null and b/XamlControlsGallery/Assets/RadioButtons.png differ diff --git a/XamlControlsGallery/ControlPages/RadioButtonPage.xaml b/XamlControlsGallery/ControlPages/RadioButtonPage.xaml index 8d7269f29..9630f56c3 100644 --- a/XamlControlsGallery/ControlPages/RadioButtonPage.xaml +++ b/XamlControlsGallery/ControlPages/RadioButtonPage.xaml @@ -15,35 +15,25 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - - - - - - - - - - - - - - - + + + + + + + + + + -<StackPanel> - <TextBlock Text="Options:"/> - <RadioButton x:Name="Option1RadioButton" Content="Option 1" Checked="Option1RadioButton_Checked"/> - <RadioButton x:Name="Option2RadioButton" Content="Option 2" Checked="Option2RadioButton_Checked"/> - <RadioButton x:Name="Option3RadioButton" Content="Option 3" Checked="Option3RadioButton_Checked"/> -</StackPanel> +<muxc:RadioButtons Header="Options:"> + <RadioButton Content="Option 1" Checked="RadioButton_Checked"/> + <RadioButton Content="Option 2" Checked="RadioButton_Checked"/> + <RadioButton Content="Option 3" Checked="RadioButton_Checked"/> +</muxc:RadioButtons> - - + diff --git a/XamlControlsGallery/ControlPages/RadioButtonPage.xaml.cs b/XamlControlsGallery/ControlPages/RadioButtonPage.xaml.cs index 99b10cc31..caf7cadad 100644 --- a/XamlControlsGallery/ControlPages/RadioButtonPage.xaml.cs +++ b/XamlControlsGallery/ControlPages/RadioButtonPage.xaml.cs @@ -21,19 +21,9 @@ public RadioButtonPage() this.InitializeComponent(); } - private void Option1RadioButton_Checked(object sender, RoutedEventArgs e) + private void RadioButton_Checked(object sender, RoutedEventArgs e) { - Control1Output.Text = "You selected option 1."; - } - - private void Option2RadioButton_Checked(object sender, RoutedEventArgs e) - { - Control1Output.Text = "You selected option 2."; - } - - private void Option3RadioButton_Checked(object sender, RoutedEventArgs e) - { - Control1Output.Text = "You selected option 3."; + Control1Output.Text = string.Format("You selected {0}", (sender as RadioButton).Content.ToString()); } } } diff --git a/XamlControlsGallery/ControlPages/RadioButtonsPage.xaml b/XamlControlsGallery/ControlPages/RadioButtonsPage.xaml index 0381b0ebe..65c3ab188 100644 --- a/XamlControlsGallery/ControlPages/RadioButtonsPage.xaml +++ b/XamlControlsGallery/ControlPages/RadioButtonsPage.xaml @@ -19,15 +19,15 @@ mc:Ignorable="d" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> - + - + Green Yellow White - + Green Yellow White @@ -37,20 +37,22 @@ -<StackPanel> - <muxc:RadioButtons MaxColumns="4" Header="Background" SelectedIndex="1" SelectionChanged="BackgroundColor_SelectionChanged"> - <x:String>Green</x:String> - <x:String>Yellow</x:String> - <x:String>White</x:String> - </muxc:RadioButtons> - <muxc:RadioButtons MaxColumns="4" Header="Border" SelectedIndex="2" SelectionChanged="BorderBrush_SelectionChanged"> - <x:String>Green</x:String> - <x:String>Yellow</x:String> - <x:String>White</x:String> - </muxc:RadioButtons> -</StackPanel> +<muxc:RadioButtons x:Name="BackgroundRadioButtons" SelectedIndex="$(BackgroundRadioButtonsSubstitution)" MaxColumns="3" Header="Background" SelectionChanged="BackgroundColor_SelectionChanged"> + <x:String>Green</x:String> + <x:String>Yellow</x:String> + <x:String>White</x:String> +</muxc:RadioButtons> +<muxc:RadioButtons x:Name="BorderRadioButtons" SelectedIndex="$(BorderRadioButtonsSubstitution)" MaxColumns="3" Header="Border" SelectionChanged="BorderBrush_SelectionChanged"> + <x:String>Green</x:String> + <x:String>Yellow</x:String> + <x:String>White</x:String> +</muxc:RadioButtons> + + + + - + diff --git a/XamlControlsGallery/DataModel/ControlInfoData.json b/XamlControlsGallery/DataModel/ControlInfoData.json index b7d208b7b..523017533 100644 --- a/XamlControlsGallery/DataModel/ControlInfoData.json +++ b/XamlControlsGallery/DataModel/ControlInfoData.json @@ -894,12 +894,11 @@ { "UniqueId": "RadioButton", "Title": "RadioButton", - "Subtitle": "A control that allows a user to select a single option from a group of options. When radio buttons are grouped together they are mutually exclusive.", + "Subtitle": "A control that allows a user to select a single option from a group of options.", "ImagePath": "ms-appx:///Assets/RadioButton.png", - "Description": "Use RadioButtons to let a user choose between mutually exclusive, related options.", + "Description": "Use RadioButtons to let a user choose between mutually exclusive, related options. Generally contained within a RadioButtons group control.", "Content": "

Look at the RadioButtonPage.xaml file in Visual Studio to see the full code for this page.

", - "IsNew": false, - "IsPreview": true, + "IsUpdated": true, "Docs": [ { "Title": "RadioButton - API", @@ -917,32 +916,6 @@ "ToggleButton" ] }, - { - "UniqueId": "RadioButtons", - "Title": "RadioButtons", - "Subtitle": "A control that allows a user to select a single option from a group of options. The RadioButtons control makes the available options mutually exclusive", - "ImagePath": "ms-appx:///Assets/RadioButton.png", - "Description": "Use RadioButtons to let a user choose between mutually exclusive, related options.", - "Content": "

Look at the RadioButtonsPage.xaml file in Visual Studio to see the full code for this page.

", - "IsNew": false, - "IsPreview": true, - "Docs": [ - { - "Title": "RadioButtons - API", - "Uri": "https://docs.microsoft.com/uwp/api/microsoft.ui.xaml.controls.radiobuttons?view=winui-2.4" - }, - { - "Title": "Guidelines", - "Uri": "https://docs.microsoft.com/windows/uwp/design/controls-and-patterns/radio-button" - } - ], - "RelatedControls": [ - "CheckBox", - "RadioButton", - "ToggleSwitch", - "ToggleButton" - ] - }, { "UniqueId": "RatingControl", "Title": "RatingControl", @@ -1376,6 +1349,31 @@ "VariableSizedWrapGrid", "RelativePanel" ] + }, + { + "UniqueId": "RadioButtons", + "Title": "RadioButtons", + "Subtitle": "A control that displays a group of mutually exclusive options with keyboarding and accessibility support.", + "ImagePath": "ms-appx:///Assets/RadioButtons.png", + "Description": "A control that displays a group of mutually exclusive options with keyboarding and accessibility support.", + "Content": "

Look at the RadioButtonsPage.xaml file in Visual Studio to see the full code for this page.

", + "IsNew": true, + "Docs": [ + { + "Title": "RadioButtons - API", + "Uri": "https://docs.microsoft.com/uwp/api/microsoft.ui.xaml.controls.radiobuttons?view=winui-2.4" + }, + { + "Title": "Guidelines", + "Uri": "https://docs.microsoft.com/windows/uwp/design/controls-and-patterns/radio-button" + } + ], + "RelatedControls": [ + "CheckBox", + "RadioButton", + "ToggleSwitch", + "ToggleButton" + ] }, { "UniqueId": "RelativePanel", diff --git a/XamlControlsGallery/XamlControlsGallery.csproj b/XamlControlsGallery/XamlControlsGallery.csproj index bf9c9b0ac..9e2a6558f 100644 --- a/XamlControlsGallery/XamlControlsGallery.csproj +++ b/XamlControlsGallery/XamlControlsGallery.csproj @@ -110,6 +110,7 @@ +