Skip to main content

RepositoryItemTokenEdit.EditValueType Property

Gets or sets the type of this TokenEdit‘s edit value.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

[DefaultValue(TokenEditValueType.String)]
[DXCategory("Data")]
public TokenEditValueType EditValueType { get; set; }

Property Value

Type Default Description
TokenEditValueType String

A TokenEditValueType enumeration value that specifies the type of this TokenEdit‘s edit value.

Available values:

Name Description
String

The EditValue property returns a System.String value that contains the selected tokens separated with a comma.

List

The EditValue property returns a ComponentModel.BindingList object that contains selected tokens.

Enum

The EditValue property returns System.Enum values, which are selected tokens.

Remarks

Depending on the EditValueType property value, the editor’s EditValue property returns a value of the following type:

Example

The following code populates a TokenEdit with enumeration values.

TokenEdit - InPlace Toke With Enum Values

    //Create a RepositoryItemTokenEdit that works with an enumeration.
    RepositoryItemTokenEdit tokenRep = new DevExpress.XtraEditors.Repository.RepositoryItemTokenEdit() { EditValueType = DevExpress.XtraEditors.TokenEditValueType.Enum };
    //Populate the editor with the enumeration values.
    tokenRep.Tokens.AddEnum(typeof(ProductCategory));
    //Add the editor to the GridControl's repository item collection.
    gridControl1.RepositoryItems.Add(tokenRep);
    //Assign the RepositoryItemTokenEdit object to the Category column.
    gridView1.Columns["Category"].ColumnEdit = tokenRep;
    gridView1.SetRowCellValue(0, "Category", ProductCategory.Meat | ProductCategory.DairyProducts);

    //The Product class instances are displayed within the GridControl.
    public class Product {
        public double UnitPrice { get; set; }
        [EnumDataType(typeof(ProductCategory))]
        public ProductCategory Category { get; set; }
        public int Quantity { get; set; }
        public string Text { get; set; }
        [DataType(DataType.MultilineText)]
        public string MultilineText { get; set; }
        [DataType(DataType.Currency), Range(200, 5000)]
        public int Currency { get; set; }
        [DataType(DataType.Date)]
        public DateTime Date { get; set; }
        [DataType(DataType.Time)]
        public DateTime Time { get; set; }
    }

    //A custom enumeration. The Flags attribute is mandatory.
    [Flags]
    public enum ProductCategory {
        //Use integers that permit bitwise combinations.
        Fruit = 1,
        Vegetables = 2,
        Meat = 4,
        Condiments = 8,
        Confections = 16,
        DairyProducts = 32,
        GrainsCereals = 64,
        Seafood = 128,
        //If both 'Fruit' and 'Meat' tokens are added, the EditValue property returns 'All'.
        All = Fruit | Meat
    }

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the EditValueType property.

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.

See Also