-
Notifications
You must be signed in to change notification settings - Fork 1
/
ViewModel.vb
99 lines (77 loc) · 3.48 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
95
96
97
98
99
Imports DevExpress.Mvvm
Imports System.Collections.ObjectModel
Imports System
Namespace Hamburger.ViewModel
Public Class MainViewModel
Inherits NavigationViewModelBase
Public Property SelectedItem As HamburgerMenuItemViewModel
Get
Return GetProperty(Function() Me.SelectedItem)
End Get
Set(ByVal value As HamburgerMenuItemViewModel)
SetProperty(Function() SelectedItem, value)
End Set
End Property
Public Property IsMenuVisible As Boolean
Get
Return GetProperty(Function() Me.IsMenuVisible)
End Get
Set(ByVal value As Boolean)
SetProperty(Function() IsMenuVisible, value)
End Set
End Property
Public Property Items As ObservableCollection(Of HamburgerMenuItemViewModel)
Get
Return GetProperty(Function() Me.Items)
End Get
Set(ByVal value As ObservableCollection(Of HamburgerMenuItemViewModel))
SetProperty(Function() Items, value)
End Set
End Property
Public Property SubItems As ObservableCollection(Of HamburgerSubMenuItemViewModel)
Get
Return GetProperty(Function() Me.SubItems)
End Get
Set(ByVal value As ObservableCollection(Of HamburgerSubMenuItemViewModel))
SetProperty(Function() SubItems, value)
End Set
End Property
Private ReadOnly Property NavigationService As INavigationService
Get
Return GetService(Of INavigationService)()
End Get
End Property
Public Sub New()
Items = New ObservableCollection(Of HamburgerMenuItemViewModel)()
Items.Add(New HamburgerSubMenuItemViewModel("Main Page", GetType(MainPage)) With {.SubItems = New ObservableCollection(Of HamburgerSubMenuItemViewModel)() From {New HamburgerSubMenuItemViewModel("SubMenu1", GetType(MainPage)), New HamburgerSubMenuItemViewModel("SubMenu", GetType(MainPage_SubPage))}})
Items.Add(New HamburgerMenuItemViewModel("Simple Page", GetType(SimplePage)))
SelectedItem = Items(0)
IsMenuVisible = True
End Sub
End Class
Public Class HamburgerMenuItemViewModel
Implements ISupportParentViewModel
Private _SubItems As ObservableCollection(Of Hamburger.ViewModel.HamburgerSubMenuItemViewModel)
Public Property Caption As String
Public Property PageName As Type
Public Property SubItems As ObservableCollection(Of HamburgerSubMenuItemViewModel)
Get
Return _SubItems
End Get
Friend Set(ByVal value As ObservableCollection(Of HamburgerSubMenuItemViewModel))
_SubItems = value
End Set
End Property
Public Property ParentViewModel As Object Implements ISupportParentViewModel.ParentViewModel
Public Sub New(ByVal caption As String, ByVal pageName As Type)
Me.Caption = caption
Me.PageName = pageName
End Sub
End Class
Public Class HamburgerSubMenuItemViewModel
Inherits HamburgerMenuItemViewModel
Public Sub New(ByVal caption As String, ByVal pageName As Type)
MyBase.New(caption, pageName)
End Sub
End Class
End Namespace