From 876c4aaa1fd21aa48828b2d9036399b49ab119af Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 28 Feb 2023 18:49:22 -0500 Subject: [PATCH] Set a GroupName when creating new WinUI RadioButtons This fixes issue #11418 --- .../Handlers/RadioButton/RadioButtonHandler.Windows.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Core/src/Handlers/RadioButton/RadioButtonHandler.Windows.cs b/src/Core/src/Handlers/RadioButton/RadioButtonHandler.Windows.cs index ca0a923d62c5..bbdfc28ac144 100644 --- a/src/Core/src/Handlers/RadioButton/RadioButtonHandler.Windows.cs +++ b/src/Core/src/Handlers/RadioButton/RadioButtonHandler.Windows.cs @@ -1,11 +1,16 @@ -using Microsoft.UI.Xaml; +using System; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; namespace Microsoft.Maui.Handlers { public partial class RadioButtonHandler : ViewHandler { - protected override RadioButton CreatePlatformView() => new RadioButton(); + protected override RadioButton CreatePlatformView() + { + // Note: We set a random GUID as the GroupName as part of the work-around in https://github.com/dotnet/maui/issues/11418 + return new RadioButton() { GroupName = Guid.NewGuid().ToString() }; + } protected override void ConnectHandler(RadioButton platformView) {