Share

RadioButtonGroup Class

Represents a group of related buttons in the Ribbon.

Inheritance Hierarchy

System.Object
  Autodesk.Revit.UI.RibbonItem
    Autodesk.Revit.UI.RadioButtonGroup


Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 26.1.0.0 (26.1.0.34)

Syntax

C#

public class RadioButtonGroup : RibbonItem

The RadioButtonGroup type exposes the following members.

Properties

 NameDescription
Public propertyCurrentGets or sets the current checked ToggleButton of the RadioButtonGroup.
Public propertyEnabledGets or sets a value indicating whether the item is enabled.
(Inherited from RibbonItem)
Public propertyItemTextGets or sets the text displayed on the item.
(Inherited from RibbonItem)
Public propertyItemTypeGets the item type.
(Inherited from RibbonItem)
Public propertyLongDescription Long description of the command tooltip
(Inherited from RibbonItem)
Public propertyNameThe name of the item.
(Inherited from RibbonItem)
Public propertyToolTipThe description that appears as a ToolTip for the item.
(Inherited from RibbonItem)
Public propertyToolTipImageThe image to show as a part of the button extended tooltip
(Inherited from RibbonItem)
Public propertyVisibleGets or sets a value indicating whether the item is visible.
(Inherited from RibbonItem)

Methods

 NameDescription
Public methodAddItemAdds a new ToggleButton to the RadioButtonGroup.
Public methodAddItemsAdds new ToggleButtons to the RadioButtonGroup.
Public methodEquals Determines whether the specified Object is equal to the current Object.
(Inherited from RibbonItem)
Public methodGetContextualHelpGets the contextual help bound with this control.
(Inherited from RibbonItem)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetItemsGets the collection of ToggleButtons assigned to the RadioButtonGroup.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodSetContextualHelpSets the contextual help bound with this button.
(Inherited from RibbonItem)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)

Remarks

This class contains a collection of ToggleButtons. Only one of the ToggleButtons will appear active at a given time. When a different button is clicked in the UI the current ToggleButton will be changed, and the ToggleButton's external command will be invoked. Use of this class is not supported in Revit Macros.

Example

C#

private void AddRadioGroup(RibbonPanel panel)
{
    // add radio button group
    RadioButtonGroupData radioData = new RadioButtonGroupData("radioGroup");
    RadioButtonGroup radioButtonGroup = panel.AddItem(radioData) as RadioButtonGroup;

    // create toggle buttons and add to radio button group
    ToggleButtonData tb1 = new ToggleButtonData("toggleButton1", "Red");
    tb1.ToolTip = "Red Option";
    tb1.LargeImage = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Red.bmp"));
    ToggleButtonData tb2 = new ToggleButtonData("toggleButton2", "Green");
    tb2.ToolTip = "Green Option";
    tb2.LargeImage = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Green.bmp"));
    ToggleButtonData tb3 = new ToggleButtonData("toggleButton3", "Blue");
    tb3.ToolTip = "Blue Option";
    tb3.LargeImage = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Blue.bmp"));
    radioButtonGroup.AddItem(tb1);
    radioButtonGroup.AddItem(tb2);
    radioButtonGroup.AddItem(tb3);
}

VB

Private Sub AddRadioGroup(panel As RibbonPanel)
   ' add radio button group
   Dim radioData As New RadioButtonGroupData("radioGroup")
   Dim radioButtonGroup As RadioButtonGroup = TryCast(panel.AddItem(radioData), RadioButtonGroup)

   ' create toggle buttons and add to radio button group
   Dim tb1 As New ToggleButtonData("toggleButton1", "Red")
   tb1.ToolTip = "Red Option"
   tb1.LargeImage = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Red.bmp"))
   Dim tb2 As New ToggleButtonData("toggleButton2", "Green")
   tb2.ToolTip = "Green Option"
   tb2.LargeImage = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Green.bmp"))
   Dim tb3 As New ToggleButtonData("toggleButton3", "Blue")
   tb3.ToolTip = "Blue Option"
   tb3.LargeImage = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Blue.bmp"))
   radioButtonGroup.AddItem(tb1)
   radioButtonGroup.AddItem(tb2)
   radioButtonGroup.AddItem(tb3)
End Sub

See Also

Reference

Was this information helpful?