-
Notifications
You must be signed in to change notification settings - Fork 0
/
HamburgerMenuItems.vb
93 lines (80 loc) · 3.11 KB
/
HamburgerMenuItems.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.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.Runtime.CompilerServices
Imports System.ComponentModel
Public Class HamburgerMenuItems
Implements INotifyPropertyChanged
Implements INotifyCollectionChanged
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Private Sub NotifyPropertyChanged(ByVal propertyName As String)
Dim myPropertyChangedEventHandler As PropertyChangedEventHandler = PropertyChangedEvent
If Nothing IsNot myPropertyChangedEventHandler Then
myPropertyChangedEventHandler(Me, New PropertyChangedEventArgs(propertyName))
End If
End Sub
Public Event CollectionChanged As NotifyCollectionChangedEventHandler Implements INotifyCollectionChanged.CollectionChanged
Private Sub NotifyCollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
Dim myCollectionChangedEventHandler As NotifyCollectionChangedEventHandler = CollectionChangedEvent
If Nothing IsNot myCollectionChangedEventHandler Then
myCollectionChangedEventHandler(Me, New NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset))
End If
End Sub
Public Sub New()
Items = New ObservableCollection(Of HamburgerMenuItems)()
End Sub
Private _items As ObservableCollection(Of HamburgerMenuItems)
Public Property Items() As ObservableCollection(Of HamburgerMenuItems)
Get
Return _items
End Get
Private Set(ByVal value As ObservableCollection(Of HamburgerMenuItems))
_items = value
End Set
End Property
Private _Caption As String
Public Property Caption() As String
Get
Return _Caption
End Get
Set(ByVal value As String)
If Not value.Equals(_Caption) Then
_Caption = value
NotifyPropertyChanged("Caption")
End If
End Set
End Property
Private _Icon As String
Public Property Icon() As String
Get
Return _Icon
End Get
Set(ByVal value As String)
If Not value.Equals(_Icon) Then
_Icon = value
NotifyPropertyChanged("Icon")
End If
End Set
End Property
Private _Selected As String
Public Property Selected() As String
Get
Return _Selected
End Get
Set(ByVal value As String)
If Not value.Equals(_Selected) Then
_Selected = value
NotifyPropertyChanged("Selected")
End If
End Set
End Property
End Class
Public Module ExtensionModule
<Extension()>
Public Sub Sort(Of TSource, TKey)(source As Collection(Of TSource), keySelector As Func(Of TSource, TKey))
Dim sortedList = source.OrderBy(keySelector).ToList()
source.Clear()
For Each sortedItem In sortedList
source.Add(sortedItem)
Next
End Sub
End Module