WPF DataGrid: DataGridComboxBox ItemsSource Binding to a Collection of Collections

Firstly, this should be easy… secondly, why are you building (and binding) columns in C#? Eek. XAML (I’m using a regular grid because I’m lazy): <ListView Name=”MyListView”> <ListView.View> <GridView> <GridView.Columns> <GridViewColumn DisplayMemberBinding=”{Binding Operation}” /> <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate> <ComboBox ItemsSource=”{Binding Choices}” /> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView.Columns> </GridView> </ListView.View> </ListView> C#: void Window1_Loaded(object sender, RoutedEventArgs e) { … Read more

ItemContainerGenerator.ContainerFromItem() returns null?

I found something that worked better for my case in this StackOverflow question: Get row in datagrid By putting in UpdateLayout and a ScrollIntoView calls before calling ContainerFromItem or ContainerFromIndex, you cause that part of the DataGrid to be realized which makes it possible for it return a value for ContainerFromItem/ContainerFromIndex: dataGrid.UpdateLayout(); dataGrid.ScrollIntoView(dataGrid.Items[index]); var row … Read more