Back to Devexpress

RadioGroupItemCollection.Add(RadioGroupItem) Method

windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-radiogroupitemcollection-dot-add-x28-devexpress-dot-xtraeditors-dot-controls-dot-radiogroupitem-x29.md

latest6.4 KB
Original Source

RadioGroupItemCollection.Add(RadioGroupItem) Method

Adds a new item to the current radio group collection.

Namespace : DevExpress.XtraEditors.Controls

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual void Add(
    RadioGroupItem item
)
vb
Public Overridable Sub Add(
    item As RadioGroupItem
)

Parameters

NameTypeDescription
itemRadioGroupItem

The RadioGroupItem object representing the new item in the collection.

|

Remarks

The Add method adds a new item at the end of the current collection. The object representing the item is passed as the item parameter. Whenever you select an item in the radio group editor, the RadioGroup.SelectedIndex property value is set to the corresponding object’s index within the RepositoryItemRadioGroup.Items collection.

To add several objects at once, see the RadioGroupItemCollection.AddRange method. To insert an object at a specified position, use the RadioGroupItemCollection.Insert method.

To remove an item from the collection, use the RadioGroupItemCollection.Remove method.

Note : to ensure proper functionality of the editor, items in the RepositoryItemRadioGroup.Items collection must be unique objects.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(RadioGroupItem) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-grid-use-layoutview-as-master-view/CS/WindowsApplication3/Form1.cs#L31

csharp
radioGroup1.Properties.Items.Add(new DevExpress.XtraEditors.Controls.RadioGroupItem(ViewType.Grid, "Grid"));
radioGroup1.Properties.Items.Add(new DevExpress.XtraEditors.Controls.RadioGroupItem(ViewType.Layout, "Layout"));

winforms-grid-multi-cell-editing/CS/Form1.cs#L18

csharp
radioGroup.Properties.Columns = 2;
radioGroup.Properties.Items.Add(new DevExpress.XtraEditors.Controls.RadioGroupItem(ChangeMode.Cell, "Cell"));
radioGroup.Properties.Items.Add(new DevExpress.XtraEditors.Controls.RadioGroupItem(ChangeMode.Column, "Column"));

reporting-winforms-implement-custom-parameter-editor/CS/XtraReport1.cs#L34

csharp
foreach (var item in radioGroupItemTitles) {
    radioGroup.Properties.Items.Add(new RadioGroupItem(item, item));
}

winforms-grid-use-layoutview-as-master-view/VB/WindowsApplication3/Form1.vb#L32

vb
radioGroup1.Properties.Items.Add(New DevExpress.XtraEditors.Controls.RadioGroupItem(ViewType.Grid, "Grid"))
radioGroup1.Properties.Items.Add(New DevExpress.XtraEditors.Controls.RadioGroupItem(ViewType.Layout, "Layout"))

winforms-grid-multi-cell-editing/VB/Form1.vb#L19

vb
radioGroup.Properties.Columns = 2
radioGroup.Properties.Items.Add(New DevExpress.XtraEditors.Controls.RadioGroupItem(ChangeMode.Cell, "Cell"))
radioGroup.Properties.Items.Add(New DevExpress.XtraEditors.Controls.RadioGroupItem(ChangeMode.Column, "Column"))

reporting-winforms-implement-custom-parameter-editor/VB/XtraReport1.vb#L36

vb
For Each item In radioGroupItemTitles
    radioGroup.Properties.Items.Add(New RadioGroupItem(item, item))
Next item

See Also

AddRange(RadioGroupItem[])

Item[Int32]

RadioGroupItem

Insert(Int32, RadioGroupItem)

RadioGroupItemCollection Class

RadioGroupItemCollection Members

DevExpress.XtraEditors.Controls Namespace