Skip to main content

RadioGroupItemCollection.AddEnum(Type, Converter<Object, String>) Method

Adds items that represent elements of the specified enumeration to the current collection. Enumeration values are converted to string values using the specified method to represent item descriptions.

Namespace: DevExpress.XtraEditors.Controls

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public void AddEnum(
    Type enumType,
    Converter<object, string> displayTextConverter
)

Parameters

Name Type Description
enumType Type

A System.Type object that is an enumeration whose elements should be added to the current collection.

displayTextConverter Converter<Object, String>

A method that converts enumeration values to string values. The returned string representation for each enumeration value is assigned to the RadioGroupItem.Description property of the corresponding RadioGroupItem added to the current collection.

Remarks

This method fetches elements from the specified enumeration and creates new items within the collection that represent these elements. An item’s value and description are set so as to identify the corresponding element. So, when a specific item is selected in the RadioGroup control, the editor’s edit value is set to the corresponding enumeration value. The item’s description is specified by the string value converted from the corresponding enumeration value using the method specified by the displayTextConverter parameter.

You can handle the RadioGroup.SelectedIndexChanged or RepositoryItem.EditValueChanged event to respond to edit value changes.

See Also