-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.vb
93 lines (75 loc) · 2.68 KB
/
MainWindow.xaml.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
Imports System.Windows
Imports System.Collections.ObjectModel
Imports DevExpress.Mvvm
Imports System.Windows.Media
Imports DevExpress.Xpf.Grid
Namespace DXGridSample
Public Partial Class MainWindow
Inherits System.Windows.Window
Public Sub New()
Me.InitializeComponent()
End Sub
End Class
Public Class ViewModel
Inherits DevExpress.Mvvm.BindableBase
Public Property Countries As ObservableCollection(Of String)
Get
Return GetValue(Of System.Collections.ObjectModel.ObservableCollection(Of String))()
End Get
Set(ByVal value As ObservableCollection(Of String))
SetValue(value)
End Set
End Property
Public Property Items As ObservableCollection(Of DXGridSample.Item)
Get
Return GetValue(Of System.Collections.ObjectModel.ObservableCollection(Of DXGridSample.Item))()
End Get
Set(ByVal value As ObservableCollection(Of DXGridSample.Item))
SetValue(value)
End Set
End Property
Public Property HighlightVisited As Boolean
Get
Return GetValue(Of Boolean)()
End Get
Set(ByVal value As Boolean)
SetValue(value)
End Set
End Property
Public Sub New()
Me.Countries = New System.Collections.ObjectModel.ObservableCollection(Of String) From {"USA", "Germany", "Russia"}
Me.Items = New System.Collections.ObjectModel.ObservableCollection(Of DXGridSample.Item)()
Dim i As Integer = 0
For Each country In Me.Countries
Me.Items.Add(New DXGridSample.Item With {.Country = country, .Visits = System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1)})
Next
End Sub
End Class
Public Class Item
Inherits DevExpress.Mvvm.BindableBase
Public Property Country As String
Get
Return GetValue(Of String)()
End Get
Set(ByVal value As String)
SetValue(value)
End Set
End Property
Public Property Visits As Integer
Get
Return GetValue(Of Integer)()
End Get
Set(ByVal value As Integer)
SetValue(value)
End Set
End Property
Public Property Color As Color
Get
Return GetValue(Of System.Windows.Media.Color)()
End Get
Set(ByVal value As Color)
SetValue(value)
End Set
End Property
End Class
End Namespace