Skip to main content

RadioGroupItemCollection Class

Represents a collection of items within a radio group editor.

Namespace: DevExpress.XtraEditors.Controls

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[ListBindable(false)]
public class RadioGroupItemCollection :
    CollectionBase,
    IEnumerable<RadioGroupItem>,
    IEnumerable

The following members return RadioGroupItemCollection objects:

Remarks

The collection of items in a RadioGroup editor can be accessed via the repository item’s RepositoryItemRadioGroup.Items property. This property returns a RadioGroupItemCollection object whose members can be used to manage the collection. You can add, remove, access individual items and perform other common collection management tasks using the object’s properties and methods.

Individual items are objects which mean that they can be of any type. When selecting an item, the value representing the item is assigned to the editor’s BaseEdit.EditValue property.

Note: to ensure that the editor works correctly, items in the RepositoryItemRadioGroup.Items collection must be unique objects.

Example

The following code shows how to add items to a RadioGroup and then select one of the items. To select an item, the item’s value is assigned to the editor’s BaseEdit.EditValue property.

RadioGroupClass

using DevExpress.XtraEditors.Controls;

// Create five items.
object[] itemValues = new object[] {10, 11, 12, 13, 14};
string [] itemDescriptions = new string [] {"Circle", "Rectangle", "Ellipse", "Triangle", "Square"};
for(int i = 0; i < itemValues.Length; i++) {
    radioGroup1.Properties.Items.Add(new RadioGroupItem(itemValues[i], itemDescriptions[i]));
}
//Select the Rectangle item.
radioGroup1.EditValue = 11;

Inheritance

Object
CollectionBase
RadioGroupItemCollection
See Also