DataFormComboBoxField binding to a list

2 posts, 1 answers
  1. Balaji
    Balaji avatar
    8 posts
    Member since:
    Aug 2011

    Posted 01 Sep 2011 Link to this post

    I have a simple list with two properties namely Status name and StatusId
    I tried to bind with the Dataformcomboboxfield in raddataform on control loaded event.
    I set the DisplayMemberpath and selectedvalue path but sadly my Combobox is displaying me the Namespace of the Binded class not the actual values.
    Following is my Implemented Code
    The below code is what i have written in the StatusLoaded event where uxComboBindList is a list populated from database.
    StatusName and StatusId are the properties of the class
    ((Telerik.Windows.Controls.DataFormComboBoxField) sender).ItemsSource = uxComboBindList;
     ((Telerik.Windows.Controls.DataFormComboBoxField)sender).DisplayMemberPath ="StatusName";
    ((Telerik.Windows.Controls.DataFormComboBoxField) sender). = "StatusId";
    <telerik:DataFormComboBoxField Loaded="uxStatus_Loaded" x:Name="uxStatus"  />
    On the UI i see the Namespace of the class not the Statusname .
    Kindly help.
  2. Answer
    Pavel Pavlov
    Pavel Pavlov avatar
    2039 posts

    Posted 03 Sep 2011 Link to this post

    Hi Balaji,

    The cause of the observed behavior is that you set the Display Member too late.
    When the control is loaded , it has already initialized the internal combo box.

    I am attaching a project with the recommended way.

    Best wishes,
    Pavel Pavlov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft R3 2016 release webinar banner
Back to Top