-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewModel.vb
94 lines (74 loc) · 2.52 KB
/
ViewModel.vb
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Imports DevExpress.Mvvm
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Namespace MasterDetailInside
Public Class ParentDataItem
Inherits BindableBase
Public Property Text As String
Get
Return GetValue(Of String)()
End Get
Set(ByVal value As String)
SetValue(value)
End Set
End Property
Public Property Number As Integer
Get
Return GetValue(Of Integer)()
End Get
Set(ByVal value As Integer)
SetValue(value)
End Set
End Property
Public Property Data As ObservableCollection(Of DataItem)
Get
Return GetValue(Of ObservableCollection(Of DataItem))()
End Get
Set(ByVal value As ObservableCollection(Of DataItem))
SetValue(value)
End Set
End Property
End Class
Public Class DataItem
Inherits BindableBase
Public Property Ready As Boolean
Get
Return GetValue(Of Boolean)()
End Get
Set(ByVal value As Boolean)
SetValue(value)
End Set
End Property
Public Property Text As String
Get
Return GetValue(Of String)()
End Get
Set(ByVal value As String)
SetValue(value)
End Set
End Property
Public Property Number As Integer
Get
Return GetValue(Of Integer)()
End Get
Set(ByVal value As Integer)
SetValue(value)
End Set
End Property
End Class
Public Class ViewModel
Public Property Data As ObservableCollection(Of ParentDataItem)
Public Sub New()
Data = New ObservableCollection(Of ParentDataItem)(GetData())
End Sub
Private Shared Iterator Function GetData() As IEnumerable(Of ParentDataItem)
For i As Integer = 0 To 100 - 1
Dim parentTestData = New ParentDataItem() With {.Text = "Master" & i, .Number = i, .Data = New ObservableCollection(Of DataItem)()}
For j As Integer = 0 To 50 - 1
parentTestData.Data.Add(New DataItem() With {.Text = "Detail" & j & " Master" & i, .Number = j, .Ready = j Mod 2 <> 0})
Next
Yield parentTestData
Next
End Function
End Class
End Namespace