diff --git a/src/Tizen.Wearable.CircularUI.Forms.Renderer/RadioCellRenderer.cs b/src/Tizen.Wearable.CircularUI.Forms.Renderer/RadioCellRenderer.cs index fa131f00..6b96a2ff 100644 --- a/src/Tizen.Wearable.CircularUI.Forms.Renderer/RadioCellRenderer.cs +++ b/src/Tizen.Wearable.CircularUI.Forms.Renderer/RadioCellRenderer.cs @@ -59,34 +59,13 @@ protected override EvasObject OnGetContent(Cell cell, string part) { if (part == RadioPart) { - var radioButton = new RadioButton() - { - BindingContext = cell, - Parent = cell.Parent - }; - radioButton.SetBinding(RadioButton.IsCheckedProperty, new Binding(RadioCell.OnProperty.PropertyName, BindingMode.OneTime)); - radioButton.SetBinding(RadioButton.GroupNameProperty, new Binding(RadioCell.GroupNameProperty.PropertyName)); - radioButton.CheckedChanged += (s, e) => - { - cell.SetValueFromRenderer(RadioCell.OnProperty, e.Value); - }; - var nativeView = Platform.GetOrCreateRenderer(radioButton).NativeView; + var nativeView = Platform.GetOrCreateRenderer(((RadioCell)cell).RadioButton).NativeView; nativeView.PropagateEvents = false; return nativeView; } return null; } - protected override EvasObject OnReusableContent(Cell cell, string part, EvasObject old) - { - if (!_cacheCandidate.ContainsKey(old)) - { - return null; - } - _cacheCandidate[old].BindingContext = cell; - return old; - } - protected override bool OnCellPropertyChanged(Cell cell, string property, Dictionary realizedView) { if (property == RadioCell.TextProperty.PropertyName || property == RadioCell.OnProperty.PropertyName || property == RadioCell.GroupNameProperty.PropertyName) diff --git a/src/Tizen.Wearable.CircularUI.Forms/RadioCell.cs b/src/Tizen.Wearable.CircularUI.Forms/RadioCell.cs index 94aa0cd5..39fa05ab 100644 --- a/src/Tizen.Wearable.CircularUI.Forms/RadioCell.cs +++ b/src/Tizen.Wearable.CircularUI.Forms/RadioCell.cs @@ -15,6 +15,7 @@ */ using System; +using System.ComponentModel; using Xamarin.Forms; namespace Tizen.Wearable.CircularUI.Forms @@ -74,5 +75,23 @@ public string Text /// Triggered when the radio button has changed value. /// public event EventHandler OnChanged; + + + /// + /// Internal use only. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public RadioButton RadioButton { get; } + + public RadioCell() + { + RadioButton = new RadioButton() + { + Parent = this, + BindingContext = this, + }; + RadioButton.SetBinding(RadioButton.IsCheckedProperty, new Binding(OnProperty.PropertyName)); + RadioButton.SetBinding(RadioButton.GroupNameProperty, new Binding(GroupNameProperty.PropertyName)); + } } }