Binding Enum To DataFormComboBoxField

2 posts, 0 answers
  1. Geoffrey
    Geoffrey avatar
    16 posts
    Member since:
    Mar 2011

    Posted 28 Jun 2012 Link to this post

    I'm trying to bind an enum to a DataFormComboBoxField but I'm having trouble. I can load the combo box with the items from the enum but I can't set the Selected Item. What am I doing wrong? Here the AccountType is my enum and AccountTypesSource is just the result of a telerik EnumDataSource
    <telerik:DataFormComboBoxField  
      SelectedValuePath="AccountType"
      DataMemberBinding="{Binding AccountType, Mode=TwoWay}"
      ItemsSource="{Binding AccountTypesSource}" />

     

    public EnumDataSource AccountTypesSource
    {
        get
        {
      return new EnumDataSource { EnumType = typeof(AccountTypes) };
        }
    }
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 29 Jun 2012 Link to this post

    Hello Geoffrey,

    You can define DataTemplate with RadComboBox inside and bind its SelectedValue/ SelectedItem. Please take a look at this forum thread for a reference.
     

    Kind regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top