问题
I am trying to give a new ItemsSource to a DataGridComboBoxColumn in a specific row in my program when the selection of an other DataGridComboBoxColumn in the same row is changed. The problem is that I am only able to change the ItemsSource of all rows at the same time.
Is it possible to give a specific ItemsSource for a DataGridComboBoxColumn to only one row in a Datagrid ?
This is the declaration of my DataGrid and my DataGridComboBoxColumn
<DataGrid Name="DATAGRIDSEARCH" AutoGenerateColumns="False">
<DataGridComboBoxColumn x:Name="COMBOBOXCOLUMNPROJECT" ItemsSource="{Binding}" SelectedValueBinding="{Binding Path=Project}" ClipboardContentBinding="{x:Null}" Header="Projet" SelectedItemBinding="{x:Null}" TextBinding="{x:Null}" />
</DataGrid>
// Items source of my DataGrid
public class Search
{
public PROJECT_TYPE Project { get; set; }
}
ObservableCollection<Search> Searchs = new ObservableCollection<Search>();
DATAGRIDSEARCH.ItemsSource = Searchs;
// Items source of my DataGridComboboxColumn
ObservableCollection<PROJECT_TYPE> ProjectList = new ObservableCollection<PROJECT_TYPE>();
COMBOBOXCOLUMNPROJECT.ItemsSource = ProjectList;
To change my DataGridComboBoxColumn ItemsSource i was simply doing
COMBOBOXCOLUMNPROJECT.ItemsSource = AN_OTHER_ProjectList;
But this is changing the ItemsSource of every row of this column in my DataGrid
Is There a way to choose the row that i want to change ?
Something like : COMBOBOXCOLUMNPROJECT[0].ItemsSource = AN_OTHER_ProjectList
来源:https://stackoverflow.com/questions/35708436/wpf-datagridcomboboxcolumn-different-itemssource-for-a-specific-row