WPF DataGridComboBoxColumn different ItemsSource for a specific row

帅比萌擦擦* 提交于 2019-12-12 03:53:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!