diff --git a/Xamarin.Forms.Platform.MacOS/Renderers/RadioButtonRenderer.cs b/Xamarin.Forms.Platform.MacOS/Renderers/RadioButtonRenderer.cs index 35d0c91786c..07708b12410 100644 --- a/Xamarin.Forms.Platform.MacOS/Renderers/RadioButtonRenderer.cs +++ b/Xamarin.Forms.Platform.MacOS/Renderers/RadioButtonRenderer.cs @@ -29,6 +29,12 @@ protected override void Dispose(bool disposing) { ObserveStateChange(false); + var formsButton = Control as FormsNSButton; + if (formsButton != null) + { + formsButton.Activated -= HandleActivated; + } + base.Dispose(disposing); } @@ -44,6 +50,8 @@ protected override void OnElementChanged(ElementChangedEventArgs e) btn.SetButtonType(NSButtonType.Radio); SetNativeControl(btn); ObserveStateChange(true); + + btn.Activated += HandleActivated; } UpdateContent(); @@ -156,5 +164,15 @@ void OnStateChanged() Element.IsChecked = Control.State == NSCellStateValue.On; } + + void HandleActivated(object sender, EventArgs args) + { + if (Element == null || sender == null) + { + return; + } + + Element.IsChecked = (sender as FormsNSButton).State == NSCellStateValue.On; + } } }