Class RadioButtons
Manages radio button groups, ensuring only one button is selected per group. Supports grouping by parent control or by string name.
public class RadioButtons
- Inheritance
-
RadioButtons
- Inherited Members
- Extension Methods
Constructors
RadioButtons()
Initializes a new instance of the RadioButtons class.
public RadioButtons()
Properties
All
Gets the singleton instance of the RadioButtons manager.
public static RadioButtons All { get; }
Property Value
GroupsByName
protected Dictionary<string, List<ISkiaRadioButton>> GroupsByName { get; }
Property Value
GroupsByParent
protected Dictionary<SkiaControl, List<ISkiaRadioButton>> GroupsByParent { get; }
Property Value
Methods
AddToGroup(ISkiaRadioButton, SkiaControl)
Adds a radio button control to a parent-based group. Ensures at least one button in the group is selected.
public void AddToGroup(ISkiaRadioButton control, SkiaControl parent)
Parameters
controlISkiaRadioButtonThe radio button control to add to the group.
parentSkiaControlThe parent control that defines the group.
AddToGroup(ISkiaRadioButton, string)
Adds a radio button control to a named group. Ensures at least one button in the group is selected.
public void AddToGroup(ISkiaRadioButton control, string groupName)
Parameters
controlISkiaRadioButtonThe radio button control to add to the group.
groupNamestringThe name of the group to add the control to.
GetSelected(SkiaControl)
Gets the currently selected radio button in the group associated with the specified parent control.
public SkiaControl GetSelected(SkiaControl parent)
Parameters
parentSkiaControlThe parent control that defines the radio button group.
Returns
- SkiaControl
The selected SkiaControl, or null if no button is selected or group doesn't exist.
GetSelected(string)
Gets the currently selected radio button in the group with the specified name.
public SkiaControl GetSelected(string groupName)
Parameters
groupNamestringThe name of the radio button group.
Returns
- SkiaControl
The selected SkiaControl, or null if no button is selected or group doesn't exist.
GetSelectedIndex(SkiaControl)
Gets the index of the currently selected radio button in the group associated with the specified parent control.
public int GetSelectedIndex(SkiaControl parent)
Parameters
parentSkiaControlThe parent control that defines the radio button group.
Returns
- int
The zero-based index of the selected button, or -1 if no button is selected or group doesn't exist.
GetSelectedIndex(string)
Gets the index of the currently selected radio button in the group with the specified name.
public int GetSelectedIndex(string groupName)
Parameters
groupNamestringThe name of the radio button group.
Returns
- int
The zero-based index of the selected button, or -1 if no button is selected or group doesn't exist.
RemoveFromGroup(SkiaControl, ISkiaRadioButton)
Removes a radio button control from a parent-based group. Ensures at least one button remains selected in the group.
public void RemoveFromGroup(SkiaControl parent, ISkiaRadioButton control)
Parameters
parentSkiaControlThe parent control that defines the group to remove the control from.
controlISkiaRadioButtonThe radio button control to remove.
RemoveFromGroup(string, ISkiaRadioButton)
Removes a radio button control from a named group. Ensures at least one button remains selected in the group.
public void RemoveFromGroup(string groupName, ISkiaRadioButton control)
Parameters
groupNamestringThe name of the group to remove the control from.
controlISkiaRadioButtonThe radio button control to remove.
RemoveFromGroups(ISkiaRadioButton)
Removes a radio button control from all groups it belongs to. Ensures at least one button remains selected in affected groups.
public void RemoveFromGroups(ISkiaRadioButton control)
Parameters
controlISkiaRadioButtonThe radio button control to remove from all groups.
ReportValueChange(ISkiaRadioButton, bool)
Called by radio button controls to report value changes. Manages mutual exclusion within groups and fires the Changed event.
public void ReportValueChange(ISkiaRadioButton control, bool newValue)
Parameters
controlISkiaRadioButtonThe radio button control reporting the change.
newValueboolThe new value of the control (true for selected, false for unselected).
Select(SkiaControl, int)
Selects the radio button at the specified index in the group associated with the container control.
public void Select(SkiaControl container, int index)
Parameters
containerSkiaControlThe parent control that defines the radio button group.
indexintThe zero-based index of the button to select.
Events
Changed
Occurs when a radio button selection changes in any group.
public event EventHandler Changed