There is an ItemViewModel of the following form:
public ItemViewModel(string name) { ComboBoxContent = new ObservableCollection<string>(); ComboBoxContent.Add("1"); ComboBoxContent.Add("2"); ComboBoxContent.Add("3"); Name = name; } public ObservableCollection<string> ComboBoxContent { get; set; } public string Name { get; set; } And there is an ItemsViewModel:
public ItemsViewModel() { Items = new ObservableCollection<ItemViewModel>(); Items.Add(new ItemViewModel("name1")); Items.Add(new ItemViewModel("name2")); Items.Add(new ItemViewModel("name3")); } public ObservableCollection<ItemViewModel> Items { get; set; } It is necessary to fill DataGrid with values ​​from ItemViewModel. I will give a schematic code as I imagine it:
<DataGrid ItemsSource="{Binding Items}"> <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> <DataGridComboBoxColumn Header="ComboBox" ItemsSource="{Binding ComboBoxContent}"></DataGridComboBoxColumn> </DataGrid.Columns> </DataGrid> How should I do this correctly?