Scenario: I have a ContentControl in my View whose Content property is bound with a DataGrid in ViewModel. I will find out the exact number of Columns to display in DataGrid at runtime that's why I am progrmmatically creating DataGrid in ViewModel. My DataGrid's ItemsSource is a DataTable. I am setting DataGrid's 'AutoGeneratingColumns' to False and I am manually creating columns. My DataGrid, along with many other columns, have two ComboBox type columns. I have to change ItemsSource of second ComboBox based on selected index of first ComboBox. So each row of my DataGrid can have different ItemsSource for second ComboBox.
My Question is how can I dynamically change ItemsSource of second ComboBox based on selected index in first ComboBox at runtime in a single row of DataGrid? I also would like to know if there is any better solution possible than my current approach in this scenario?