tags:

views:

661

answers:

1

Hi

I am using following code to bind combobox to the datagrid in wpf.

but when i select item from combobox and tab out, the grid does not hold the selected value.

I would like to set the selected value to the current cell of datagrid.

                                    <dg:DataGridComboBoxColumn.ItemsSource>
                                        <col:ArrayList>
                                            <sys:String>A</sys:String>
                                            <sys:String>B</sys:String>
                                            <sys:String>C</sys:String>
                                            <sys:String>D</sys:String>
                                            <sys:String>E</sys:String>
                                        </col:ArrayList>
                                    </dg:DataGridComboBoxColumn.ItemsSource>
                                </dg:DataGridComboBoxColumn>

Please do the needful.

A: 

Try this

SelectedValuePath="ProductID" DisplayMemberPath="ProductName" Header="Product" Width="135" ItemsSource="{Binding Source={StaticResource Product}}" SelectedItemBinding="{Binding Product}">