-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyGridControl.vb
111 lines (89 loc) · 3.29 KB
/
MyGridControl.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
100
101
102
103
104
105
106
107
108
109
110
111
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.Data.Details
Imports DevExpress.XtraGrid.Registrator
Imports DevExpress.Data
Namespace DXSample
Public Class MyGridControl
Inherits GridControl
Public Sub New()
MyBase.New()
End Sub
Protected Overrides Sub RegisterAvailableViewsCore(ByVal collection As InfoCollection)
MyBase.RegisterAvailableViewsCore(collection)
collection.Add(New MyGridViewInfoRegistrator())
End Sub
End Class
Public Class MyGridView
Inherits GridView
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal gridControl As GridControl)
MyBase.New(gridControl)
End Sub
Friend Const MyGridViewName As String = "MyGridView"
Protected Overrides ReadOnly Property ViewName As String
Get
Return MyGridViewName
End Get
End Property
Private fVirtualMasterDetailMode As VirtualMasterDetailMode = VirtualMasterDetailMode.Disabled
Public Property VirtualMasterDetailMode As VirtualMasterDetailMode
Get
Return fVirtualMasterDetailMode
End Get
Set(ByVal value As VirtualMasterDetailMode)
fVirtualMasterDetailMode = value
End Set
End Property
Protected Overrides Sub ApplyLevelDefaults(ByVal newGV As BaseView, ByVal defaultView As BaseView, ByVal di As DetailInfo, ByVal levelName As String)
Dim mgv As MyGridView = TryCast(newGV, MyGridView)
If mgv IsNot Nothing Then mgv.CheckRecreateDataController(di.DetailList)
MyBase.ApplyLevelDefaults(newGV, defaultView, di, levelName)
End Sub
Protected Overrides Function CreateDataController() As BaseGridController
Select Case fVirtualMasterDetailMode
Case VirtualMasterDetailMode.Master
Return New VirtualMasterDetailServerModeDataController()
Case VirtualMasterDetailMode.Detail
Return New ServerModeDataController()
Case Else
Return MyBase.CreateDataController()
End Select
End Function
End Class
Public Enum VirtualMasterDetailMode
Disabled
Master
Detail
End Enum
Public Class MyGridViewInfoRegistrator
Inherits GridInfoRegistrator
Public Sub New()
MyBase.New()
End Sub
Public Overrides ReadOnly Property ViewName As String
Get
Return MyGridView.MyGridViewName
End Get
End Property
Public Overrides Function CreateView(ByVal grid As GridControl) As BaseView
Return New MyGridView(grid)
End Function
End Class
Public Class VirtualMasterDetailServerModeDataController
Inherits ServerModeDataController
Public Sub New()
MyBase.New()
End Sub
Public Overrides Sub PopulateColumns()
Columns.Clear()
DetailColumns.Clear()
Helper.PopulateColumns()
DetailColumns.Clear()
DoRefresh()
End Sub
End Class
End Namespace