1

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

Mr Rubix
  • 1,492
  • 14
  • 27
  • 1
    I think you should use the data template selector in this case. her are a couple of links http://www.wpftutorial.net/datatemplates.html and http://wpf.2000things.com/tag/datatemplate/. – Ilan Mar 01 '16 at 07:30
  • Thanks llan i will try with a DataTemplateSelector [.](https://social.msdn.microsoft.com/Forums/vstudio/en-US/4ed93258-58b3-48b7-8f73-7a8fd131701f/datagrid-changing-celltemplate-dynamically-based-on-datatype?forum=wpf) and i will post back – Mr Rubix Mar 01 '16 at 14:08

0 Answers0