windowsforms-devexpress-dot-xtraeditors-dot-controls-734844ed.md
Represents a collection of items within a radio group editor.
Namespace : DevExpress.XtraEditors.Controls
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[ListBindable(false)]
public class RadioGroupItemCollection :
CollectionBase,
IEnumerable<RadioGroupItem>,
IEnumerable
<ListBindable(False)>
Public Class RadioGroupItemCollection
Inherits CollectionBase
Implements IEnumerable(Of RadioGroupItem),
IEnumerable
The following members return RadioGroupItemCollection objects:
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.
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.
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;
Imports DevExpress.XtraEditors.Controls
' Create five items.
Dim itemValues As Object() = New Object() {10, 11, 12, 13, 14}
Dim itemDescriptions As String() = New String () {"Circle", "Rectangle", "Ellipse", "Triangle", "Square"}
Dim i As Integer = 0
Do While i < itemValues.Length
radioGroup1.Properties.Items.Add(New RadioGroupItem(itemValues(i), itemDescriptions(i)))
i += 1
Loop
'Select the Rectangle item.
radioGroup1.EditValue = 11
Object CollectionBase RadioGroupItemCollection
See Also