-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewModel.cs
33 lines (32 loc) · 1.5 KB
/
ViewModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using DevExpress.Mvvm;
using System.Collections.ObjectModel;
namespace MasterDetailInside {
public class ViewModel : BindableBase {
public Item Level1CurrentItem { get { return GetValue<Item>(); } set { SetValue(value); } }
public Item Level2CurrentItem { get { return GetValue<Item>(); } set { SetValue(value); } }
public Item Level3CurrentItem { get { return GetValue<Item>(); } set { SetValue(value); } }
public ObservableCollection<Item> Data { get; }
public ViewModel() {
Data = new ObservableCollection<Item>();
for (int i = 0; i < 50; i++) {
Item item1 = new Item() { Id = i, Name = string.Format("Item_{0}", i), };
for (int j = 0; j < 10; j++) {
Item item2 = new Item() { Id = j, Name = string.Format("Item_{0}.{1}", i, j) };
for (int k = 0; k < 5; k++) {
item2.Items.Add(new Item() { Id = k, Name = string.Format("Item_{0}.{1}.{2}", i, j, k) });
}
item1.Items.Add(item2);
}
Data.Add(item1);
}
}
}
public class Item : BindableBase {
public int Id { get { return GetValue<int>(); } set { SetValue(value); } }
public string Name { get { return GetValue<string>(); } set { SetValue(value); } }
public ObservableCollection<Item> Items { get; }
public Item() {
Items = new ObservableCollection<Item>();
}
}
}