[EditorBrowsable(EditorBrowsableState.Never)]
public RadioButtonGroup() : base()
{
+ EnableMultiSelection = false;
}
/// <summary>
base.RemoveSelection(radio);
radio.ItemGroup = null;
}
-
- /// <summary>
- /// Handle user's select action. Turn on check state of selected RadioButton,
- /// and turn out check state of other RadioButtons in RadioButtonGroup
- /// </summary>
- /// <param name="selection">The selection selected by user</param>
- /// <since_tizen> 6 </since_tizen>
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected override void SelectionHandler(SelectButton selection)
- {
- RadioButton radio = selection as RadioButton;
- if (!ItemGroup.Contains(radio))
- {
- return;
- }
-
- foreach (RadioButton btn in ItemGroup)
- {
- if (btn != null && btn != radio && btn.IsEnabled == true)
- {
- btn.IsSelected = false;
- }
- }
- }
}
}
public int SelectedIndex => selectedIndex;
/// <summary>
+ /// EnableMultiSelection is used to indicate if SelectGroup can select multiple SelectButtons.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableMultiSelection { get; set; } = true;
+
+ /// <summary>
/// Construct SelectionGroup
/// </summary>
/// <since_tizen> 6 </since_tizen>
}
/// <summary>
- /// Overrides this method if want to handle behavior after pressing return key by user.
+ /// Called when the state of Selected is changed.
/// </summary>
/// <param name="selection">The selection selected by user</param>
/// <since_tizen> 6 </since_tizen>
if (args.IsSelected == true)
{
selectedIndex = selection.Index;
+
+ if (EnableMultiSelection == false)
+ {
+ foreach (SelectButton btn in ItemGroup)
+ {
+ if ((btn != null) && (btn != selection) && (btn.IsEnabled == true) && (btn.IsSelected == true))
+ {
+ btn.IsSelected = false;
+ }
+ }
+ }
+
SelectionHandler(selection);
}
}