-2

How to provide the enum values on to checked combobox edit control in dev express?

public enum AccessRoles
{
    User,
    Administrator
}

foreach (var item in Enum.GetValues(typeof(AccessRoles)))
{
    checkedComboBoxEdit1.Properties.Items.AddRange(Enum.GetValues(typeof(item)));
}

How do I bind the enum value on to checkedcomboBoxedit?

gunr2171
  • 12,476
  • 25
  • 58
  • 80
Myself
  • 1
  • 3
  • 2
    we need way more detail then. this. Please show some code – psoshmo Jul 15 '15 at 12:42
  • checkedComboBoxEdit1.Properties.Items.AddRange(Enum.GetValues(typeof(AccessRoles))); – Myself Jul 15 '15 at 12:47
  • possible duplicate of [How do you bind an Enum to a DropDownList control in ASP.NET?](http://stackoverflow.com/questions/61953/how-do-you-bind-an-enum-to-a-dropdownlist-control-in-asp-net) – Bsa0 Jul 15 '15 at 12:49
  • public enum AccessRoles { User, Administrator } foreach (var item in Enum.GetValues(typeof(AccessRoles))) { checkedComboBoxEdit1.Properties.Items.AddRange(Enum.GetValues(typeof(item))); } how do i bind the values of enum on to checked combo box edit in the above code? @gunr2171 – Myself Jul 15 '15 at 13:03

2 Answers2

0

try something like this. Bind your comboboxedit to your list (or whatever) of enums.

then in your comboboxedit

<dxe:ComboBoxEdit //stuff here>
     <dxmvvm:Interaction.Behaviors>
            <dxmvvm:EnumItemsSourceBehavior EnumType="{x:Type local:AccessRoles}" SortMode="DisplayName"/>
        </dxmvvm:Interaction.Behaviors>
        <dxe:ComboBoxEdit.ItemTemplate>
</dxe:ComboBoxEdit>

let me know if this works, Ive never personally tried it before. Its new to version 14.2, so if you have an older version let me know

psoshmo
  • 1,383
  • 8
  • 19
0

This piece of code worked for binding those Enum values on to CheckedComboEdit.

checkedComboBoxEdit1.Properties.DataSource = Enum.GetValues(typeof(AccessRoles));

Myself
  • 1
  • 3