-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExamples.xaml.vb
More file actions
84 lines (66 loc) · 2.21 KB
/
Examples.xaml.vb
File metadata and controls
84 lines (66 loc) · 2.21 KB
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
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Public Class Examples
Private ExmList As New ObservableCollection(Of Example)
Public Sub New()
InitializeComponent()
For Each E As Example In ExampleList.Items
ExmList.Add(E)
Next
Dim View As ICollectionView = CollectionViewSource.GetDefaultView(ExmList)
View.GroupDescriptions.Add(New PropertyGroupDescription("Group"))
'View.SortDescriptions.Add(New SortDescription("Country", ListSortDirection.Ascending))
'View.SortDescriptions.Add(New SortDescription("Name", ListSortDirection.Ascending))
ExampleList.Items.Clear()
ExampleList.ItemsSource = View
End Sub
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
End Sub
Private Sub Window_Closing(sender As Object, e As ComponentModel.CancelEventArgs)
e.Cancel = True
Me.Hide()
End Sub
Private Sub LoadExample(sender As Object, e As RoutedEventArgs)
If ExampleList.SelectedIndex <> -1 Then
Dim KeyToLoad As String = TryCast(ExampleList.SelectedItem, Example).Key & ".mgp"
TryCast(Owner, MainWindow).ReadFromResource(KeyToLoad)
Me.Hide()
End If
End Sub
End Class
Public Class Example
Public Property Key As String
Public Property Description As String
Public Property Group As String
Public ReadOnly Property ImageSource As String
Get
Return "/AKP Math Graph Plotter;component/Examples/Example Images/" + Key + ".png"
End Get
End Property
Private m_bc As Color
Public Property BackColor As Color
Get
If m_bc <> Nothing Then
Return m_bc
Else
Return Colors.Transparent
End If
End Get
Set(value As Color)
m_bc = value
End Set
End Property
Private m_fc
Public Property ForeColor As Color
Get
If m_fc <> Nothing Then
Return m_fc
Else
Return Colors.Black
End If
End Get
Set(value As Color)
m_fc = value
End Set
End Property
End Class