DataGridComboBoxColumn with bound members

Aug 22, 2008 at 4:40 PM

I need in a column of a datagrid a combobox to lookup values from another table. Therefore I would like to use a construct like this:

        <dg:DataGrid x:Name="DG" ItemsSource="{Binding}" AutoGenerateColumns="False"  >
                <dg:DataGridComboBoxColumn x:Name="ColFig"  
                                           DataFieldBinding="{Binding Path=Xxx_id}"
                                           DisplayMemberPath = "TextValue"
                                           SelectedValuePath = "Id" >

and in the code:

        ColFig.ItemsSource = From f In DB.TFigures Select f    ' delivers ID and TextValue pairs
        DGF.ItemsSource = From x In DB.Txxx Select x          

Unfortunately there is no DisplayMemberPath and SelectedValuePath.
How could be done that?

Aug 26, 2008 at 10:23 PM
I just wrote a sample for it here,  Hope that helps.
Aug 28, 2008 at 8:31 AM
Thanks a lot. It's a good hint in the right direction. But the Northwind database is not the best sample-DB. Usually we use a guid or at least an integer as key. Suchg keys will usually never shown to users.
I would like to see some other fields from the Customer's table, for example "CompanyName", in the combobox as well as in the grid column.
I could successfully load the data for the combobox but not for the grid (cells in non-editing mode)
Aug 28, 2008 at 4:00 PM
Here are a couple possible solutions for it,