In my datagrid, one of columns is DataGridComboBoxColumn, where I'm trying to display different drop down menu in every row. Easy task when creating combo box in XAML instead of doing it programatically. My problem is that I have no idea how to bind it properly. This is what I tried:
private DataGridComboBoxColumn CreateComboValueColumn(List<Elements> elements)
{
DataGridComboBoxColumn column = new DataGridComboBoxColumn();
column.ItemsSource = elements;
column.DisplayMemberPath = "Text";
column.SelectedValuePath = "ID";
column.SelectedValueBinding = new Binding("Value");
return column;
}
public class Elements
{
public string Name { get; set; }
public string Value { get; set; }
public string Comment { get; set; }
public List<ComboItem> ComboItems { get; set; }
}
public class ComboItem
{
public string ID { get; set; }
public string Text { get; set; }
}
DataGrids