-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewModel.cs
39 lines (30 loc) · 1.51 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
34
35
36
37
38
39
using DevExpress.Mvvm;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace MasterDetailInside {
public class ParentDataItem : BindableBase {
public string Text { get { return GetValue<string>(); } set { SetValue(value); } }
public int Number { get { return GetValue<int>(); } set { SetValue(value); } }
public ObservableCollection<DataItem> Data { get { return GetValue<ObservableCollection<DataItem>>(); } set { SetValue(value); } }
}
public class DataItem : BindableBase {
public bool Ready { get { return GetValue<bool>(); } set { SetValue(value); } }
public string Text { get { return GetValue<string>(); } set { SetValue(value); } }
public int Number { get { return GetValue<int>(); } set { SetValue(value); } }
}
public class ViewModel {
public ObservableCollection<ParentDataItem> Data { get; set; }
public ViewModel() {
Data = new ObservableCollection<ParentDataItem>(GetData());
}
static IEnumerable<ParentDataItem> GetData() {
for(int i = 0; i < 100; i++) {
var parentTestData = new ParentDataItem() { Text = "Master" + i, Number = i, Data = new ObservableCollection<DataItem>() };
for(int j = 0; j < 50; j++) {
parentTestData.Data.Add(new DataItem() { Text = "Detail" + j + " Master" + i, Number = j, Ready = j % 2 != 0 });
}
yield return parentTestData;
}
}
}
}