I have a DataGrid
with more columns
and rows
. What I'd like is to make that if I change a ComboBox in row 1, the Combo in row 2 should chage with it
, but nothing else. I use an Observable Collection
which stores the classes
. I have no idea how to make it...
The Collection
:
private ObservableCollection<Item> ceilingItems = new ObservableCollection<Item>();
ceilingItems.Add(new Item() { Category = language.GetString("top-mesh"), Name = "4. " + language.GetString("main-direction"), Value1 = list1, Unit1 = "mm", Value2 = list2, Unit2 = "cm", IsEditable = true });
ceilingItems.Add(new Item() { Category = "", Name = "3. " + language.GetString("side-direction"), Value1 = list1, Unit1 = "mm", Value2 = list2, Unit2 = "cm", IsEditable = false });
ceilingItems.Add(new Item() { Category = language.GetString("bottom-mesh"), Name = "2. " + language.GetString("side-direction"), Value1 = list1, Unit1="mm", Value2 = list2, Unit2 = "cm", IsEditable = false });
ceilingItems.Add(new Item() { Category = "", Name = "1. " + language.GetString("main-direction"), Value1 = list1, Unit1 = "mm", Value2 = list2, Unit2 = "cm", IsEditable = true });
ceilingItems.Add(new Item() { Category = language.GetString("lace"), Name = "", Value1 = list1, Unit1 = "mm", Value2 = list2, Unit2 = "cm", IsEditable = true });
ceilingItems.Add(new Item() { Category = language.GetString("spacer-iron"), Name = "", Value1 = list1, Unit1="mm", Value2 = list3, Unit2 = language.GetString("piece") + " / m2", IsEditable = true });
For example: if I change Value1
in the first element
, Value1
has to be the same in the second element
, but just there. (This is because of the function for what we will use them...) This collection is binded to DataGrid Columns
.
The Item
class:
public class Item: INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public string Category { get; set; }
public string Name { get; set; }
public List<int> Value1 { get; set; }
public string Unit1 { get; set; }
public List<double> Value2 { get; set; }
public string Unit2 { get; set; }
public bool IsEditable { get; set; }
}
See Question&Answers more detail:
os