The Autodesk.Revit.UI.RadioButtonGroup
class is a user interface component provided by Autodesk Revit. It represents a group of radio buttons, which allows the user to select a single option from a set of mutually exclusive choices.
Name
: Gets or sets the name of the radio button group.Items
: Gets a list of RadioButtonData
objects, which represent the individual radio buttons in the group.SelectedItem
: Gets or sets the currently selected radio button in the group.AddButton
: Adds a new radio button to the group.AddSeparator
: Adds a separator to the group.Clear
: Removes all radio buttons and separators from the group.Dispose
: Disposes of the radio button group, releasing any associated resources.SelectedChanged
: Raised when the selected radio button in the group changes.// Create a new radio button group.
RadioButtonGroup radioButtonGroup = new RadioButtonGroup();
// Add some radio buttons to the group.
radioButtonGroup.AddButton(new RadioButtonData("Option 1", true));
radioButtonGroup.AddButton(new RadioButtonData("Option 2", false));
radioButtonGroup.AddSeparator();
radioButtonGroup.AddButton(new RadioButtonData("Option 3", false));
// Add the radio button group to a layout control.
StackPanel stackPanel = new StackPanel();
stackPanel.Children.Add(radioButtonGroup);
// Handle the SelectedChanged event.
radioButtonGroup.SelectedChanged += delegate (object sender, EventArgs e)
{
Console.WriteLine("Selected radio button changed.");
};
RadioButtonData
class is used to specify the text and initial selection state of individual radio buttons in the group.SelectedItem
property returns null
if no radio button in the group is selected.