-
Notifications
You must be signed in to change notification settings - Fork 1
/
BusinessObjects.vb
90 lines (71 loc) · 2.9 KB
/
BusinessObjects.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
Imports System
Imports DevExpress.XtraTreeList
Imports DevExpress.Spreadsheet
Imports System.ComponentModel
Namespace ConditionalFormatting_Example
Public Class SpreadsheetNode
Private groupsField As GroupsOfSpreadsheetExamples = New GroupsOfSpreadsheetExamples()
Private ownerField As GroupsOfSpreadsheetExamples
Public Sub New(ByVal name As String)
Me.Name = name
End Sub
<Browsable(False)>
Public ReadOnly Property Groups As GroupsOfSpreadsheetExamples
Get
Return groupsField
End Get
End Property
Public Property Name As String
<Browsable(False)>
Public Property Owner As GroupsOfSpreadsheetExamples
Get
Return ownerField
End Get
Set(ByVal value As GroupsOfSpreadsheetExamples)
ownerField = value
End Set
End Property
End Class
Public Class SpreadsheetExample
Inherits SpreadsheetNode
Private _Action As Action(Of DevExpress.Spreadsheet.IWorkbook)
Public Sub New(ByVal name As String, ByVal action As Action(Of IWorkbook))
MyBase.New(name)
Me.Action = action
End Sub
Public Property Action As Action(Of IWorkbook)
Get
Return _Action
End Get
Private Set(ByVal value As Action(Of IWorkbook))
_Action = value
End Set
End Property
End Class
Public Class GroupsOfSpreadsheetExamples
Inherits BindingList(Of SpreadsheetNode)
Implements TreeList.IVirtualTreeListData
Private Sub VirtualTreeGetChildNodes(ByVal info As VirtualTreeGetChildNodesInfo) Implements TreeList.IVirtualTreeListData.VirtualTreeGetChildNodes
Dim obj As SpreadsheetNode = TryCast(info.Node, SpreadsheetNode)
info.Children = obj.Groups
End Sub
Protected Overrides Sub InsertItem(ByVal index As Integer, ByVal item As SpreadsheetNode)
item.Owner = Me
MyBase.InsertItem(index, item)
End Sub
Private Sub VirtualTreeGetCellValue(ByVal info As VirtualTreeGetCellValueInfo) Implements TreeList.IVirtualTreeListData.VirtualTreeGetCellValue
Dim obj As SpreadsheetNode = TryCast(info.Node, SpreadsheetNode)
Select Case info.Column.Caption
Case "Name"
info.CellData = obj.Name
End Select
End Sub
Private Sub VirtualTreeSetCellValue(ByVal info As VirtualTreeSetCellValueInfo) Implements TreeList.IVirtualTreeListData.VirtualTreeSetCellValue
Dim obj As SpreadsheetNode = TryCast(info.Node, SpreadsheetNode)
Select Case info.Column.Caption
Case "Name"
obj.Name = CStr(info.NewCellData)
End Select
End Sub
End Class
End Namespace