-
Notifications
You must be signed in to change notification settings - Fork 0
/
SankeyItemExtensionModule.vb
49 lines (47 loc) · 2.19 KB
/
SankeyItemExtensionModule.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
Imports DevExpress.DashboardCommon
Imports DevExpress.DashboardWin
Imports DevExpress.XtraBars
Imports DevExpress.XtraBars.Ribbon
Namespace DevExpresss.DashboardWin.CustomItemExtension
Public Class SankeyItemExtensionModule
Implements IExtensionModule
Private dashboardControl As IDashboardControl
Public Sub AttachViewer(ByVal viewer As DashboardViewer) Implements IExtensionModule.AttachViewer
AttachDashboardControl(viewer)
End Sub
Public Sub DetachViewer() Implements IExtensionModule.DetachViewer
Detach()
End Sub
Public Sub AttachDesigner(ByVal designer As DashboardDesigner) Implements IExtensionModule.AttachDesigner
AttachDashboardControl(designer)
designer.CreateCustomItemBars(GetType(SankeyItemMetadata))
RemoveDrillDownBarItem(designer)
End Sub
Public Sub DetachDesigner() Implements IExtensionModule.DetachDesigner
Detach()
End Sub
Private Sub Detach()
If dashboardControl IsNot Nothing Then
RemoveHandler dashboardControl.CustomDashboardItemControlCreating, AddressOf OnCustomDashboardItemControlCreating
End If
End Sub
Private Sub AttachDashboardControl(ByVal dashboardControl As IDashboardControl)
If dashboardControl IsNot Nothing Then
Me.dashboardControl = dashboardControl
dashboardControl.CalculateHiddenTotals = True
AddHandler dashboardControl.CustomDashboardItemControlCreating, AddressOf OnCustomDashboardItemControlCreating
End If
End Sub
Private Sub OnCustomDashboardItemControlCreating(ByVal sender As Object, ByVal e As CustomDashboardItemControlCreatingEventArgs)
If e.MetadataType Is GetType(SankeyItemMetadata) Then
e.CustomControlProvider = New SankeyItemControlProvider(TryCast(dashboardControl.Dashboard.Items(e.DashboardItemName), CustomDashboardItem(Of SankeyItemMetadata)))
End If
End Sub
Private Sub RemoveDrillDownBarItem(ByVal designer As DashboardDesigner)
Dim page As RibbonPage = designer.Ribbon.GetDashboardRibbonPage(GetType(SankeyItemMetadata), DashboardRibbonPage.Data)
Dim interactivityGroup As RibbonPageGroup = page.Groups(1)
Dim drillDownBarItem As BarItem = interactivityGroup.ItemLinks(2).Item
interactivityGroup.ItemLinks.Remove(drillDownBarItem)
End Sub
End Class
End Namespace