Change ItemsSource for DataGridComboBoxColumn

Oct 28, 2008 at 12:51 PM
I have two DataGridComboBoxColumns in my Grid.
I want to change the ItemsSource-Property of the second DataGridComboBoxColumn,
depending on the selection of the first combobox.
But when I change the Itemsource , it is changed for the second combobox in every row !

How can i access the Combobox in the specific editing row to set the ItemsSource only for this one?

Oct 30, 2008 at 5:28 PM
Change in DataGridComboBoxColumns.ItemsSource property effects all the cells belonging to the column, it is not for the single row. To achieve your requirements you can use Template column. Here is an example....

Say 'A' is a property on the data object which is bound to the first combobox and the value of which determines the items source of second combobox....

<toolkit:DataGridComboBoxColumn ItemsSource={StaticResource MyItemsSource} Binding={Path A} />
            <ComboBox ItemsSource={Binding Path=A, Converter=MyConverter}>

MyConverter is the converter which determines the items source collection based on the value of A. Use similar with CellEditingTemplate.