/
MainWindow.xaml.vb
85 lines (81 loc) · 2 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
Imports System.Windows
Imports System.Collections.ObjectModel
Imports DevExpress.Mvvm
Imports System.Windows.Media
Imports DevExpress.Xpf.Grid
Namespace DXGridSample
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
End Class
Public Class ViewModel
Inherits BindableBase
Public Property Countries() As ObservableCollection(Of String)
Get
Return GetValue(Of ObservableCollection(Of String))()
End Get
Set(ByVal value As ObservableCollection(Of String))
SetValue(value)
End Set
End Property
Public Property Items() As ObservableCollection(Of Item)
Get
Return GetValue(Of ObservableCollection(Of Item))()
End Get
Set(ByVal value As ObservableCollection(Of 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()
Countries = New ObservableCollection(Of String) From {"USA", "Germany", "Russia"}
Items = New ObservableCollection(Of Item)()
Dim i As Integer = 0
For Each country In Countries
'INSTANT VB WARNING: An assignment within expression was extracted from the following statement:
'ORIGINAL LINE: Items.Add(new Item { Country = country, Visits = i++ });
Items.Add(New Item With {
.Country = country,
.Visits = i
})
i += 1
Next country
End Sub
End Class
Public Class Item
Inherits 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 Color)()
End Get
Set(ByVal value As Color)
SetValue(value)
End Set
End Property
End Class
End Namespace