DataFormComboBoxField in a RadDataForm

2 posts, 0 answers
  1. Dan
    Dan avatar
    6 posts
    Member since:
    Sep 2013

    Posted 09 Oct 2013 Link to this post

    I have followed the example below and scoured the internet for 2 days trying to get my combobox to work correctly, and I still cannot get it to select the correct item when the form opens. http://www.telerik.com/help/silverlight/raddatafor-edit-lookup-values-with-radcombobox.html

    I have two classes (generated by the Openaccess ORM), one of which contains information about musicians (name, id, genre etc) and a second class that contains information about the type of musician (band, festival, performing arts etc). I have successfully added a couple of simple textbox controls to the form that display the artist name and some other basic information, and now I am trying to pick the artist type from a combo box.

    I can successfully populate the combobox from the ORM model "ArtistType" class,  but no matter what I do it always opens either with the first item selected (regardless of the actual underlying value) or nothing selected at all. If I break the code in the combobox_Loaded event, I can see the values, but they are never reflected in the combobox.

    How can I databind a simple numeric value in a primary table to a list of items in a second table to be displayed as a picklist in a combox?
  2. Dan
    Dan avatar
    6 posts
    Member since:
    Sep 2013

    Posted 09 Oct 2013 Link to this post

    Never mind. I fixed it.

    Would have been nice to have that example mention that I needed to databind the ArtistTypes table in the grid, and not just the ID from the Artist table, because my implementation sure doesn't look much like the example above.
    <telerik:DataFormDataField Grid.Column="0" Grid.Row="0" Label="Artist Name" DataMemberBinding="{Binding ArtistName, Mode=TwoWay}" />
    <telerik:DataFormComboBoxField Grid.Column="0" Grid.Row="1" Label="Artist Type"
        SelectedValuePath="ArtistTypeID"
        DataMemberBinding="{Binding ArtistType.ArtistTypeID, Mode=TwoWay}"
        DisplayMemberPath="TypeDesc"
        ItemsSource="{Binding ArtistTypes, Source={StaticResource MyModel}}"/>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top