-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainViewModel.vb
40 lines (30 loc) · 1.24 KB
/
MainViewModel.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
Imports DevExpress.Mvvm
Imports DevExpress.Mvvm.DataAnnotations
Imports DevExpress.Mvvm.POCO
Imports System.Collections.ObjectModel
Namespace Example.ViewModel
<POCOViewModel>
Public Class MainViewModel
Public Overridable Property Persons As ObservableCollection(Of Person)
Protected Overridable ReadOnly Property MessageBoxService As IMessageBoxService
Get
Return Nothing
End Get
End Property
Public Sub Initialize()
Persons = New ObservableCollection(Of Person)()
Persons.Add(ViewModelSource.Create(Function() New Person() With {.FirstName = "John", .LastName = "Smith"}))
Persons.Add(ViewModelSource.Create(Function() New Person() With {.FirstName = "Alex", .LastName = "Carter"}))
End Sub
Public Sub Edit(ByVal person As Person)
MessageBoxService.Show(String.Format("{0} {1}", person.FirstName, person.LastName))
End Sub
Public Function CanEdit(ByVal person As Person) As Boolean
Return person IsNot Nothing
End Function
End Class
Public Class Person
Public Property FirstName As String
Public Property LastName As String
End Class
End Namespace