Imports Infragistics.Win
Imports Infragistics.Win.UltraWinExplorerBar
' Handles the Form's 'Load' event
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Add the ExplorerBar to the Panel's Controls collection
Me.panel1.Controls.AddRange(New System.Windows.Forms.Control() {Me.ultraExplorerBar1})
' Dock the Panel control to the left side of the form
Me.panel1.Dock = System.Windows.Forms.DockStyle.Left
' Dock the ExplorerBar to completely fill the Panel control
Me.ultraExplorerBar1.Dock = System.Windows.Forms.DockStyle.Fill
' Set the NavigationPaneExpansionMode property to 'OnButtonClickOrSizeChanged'
' so that the navigation pane's expanded state is changed on both button clicks
' and control resizing.
Me.ultraExplorerBar1.NavigationPaneExpansionMode = NavigationPaneExpansionMode.OnButtonClickOrSizeChanged
' Set the NavigationPaneExpansionThreshold property so that resizing the
' width smaller than 50 pixels causes the navigation pane to collapse.
Me.ultraExplorerBar1.NavigationPaneExpansionThreshold = 50
' Hook the NavigationPaneExpanding and NavigationPaneCollapsing events
AddHandler Me.ultraExplorerBar1.NavigationPaneExpanding, AddressOf Me.ultraExplorerBar1_NavigationPaneExpanding
AddHandler Me.ultraExplorerBar1.NavigationPaneCollapsing, AddressOf Me.ultraExplorerBar1_NavigationPaneCollapsing
' Set the NavigationPaneExpandedState to 'Collapsed' so that the ExplorerBar is initially collapsed
Me.ultraExplorerBar1.NavigationPaneExpandedState = NavigationPaneExpandedState.Collapsed
End Sub
' Handles the ExplorerBar's 'NavigationPaneCollapsing' event.
Private Sub ultraExplorerBar1_NavigationPaneCollapsing(ByVal sender As Object, ByVal e As NavigationPaneCollapsingEventArgs)
Dim explorerBar As UltraExplorerBar = sender
Me.OnNavigationPaneExpandedStateChanging(explorerBar, e)
End Sub
' Handles the ExplorerBar's 'NavigationPaneExpanding' event.
Private Sub ultraExplorerBar1_NavigationPaneExpanding(ByVal sender As Object, ByVal e As NavigationPaneExpandingEventArgs)
Dim explorerBar As UltraExplorerBar = sender
Me.OnNavigationPaneExpandedStateChanging(explorerBar, e)
End Sub
' Helper method which handles synchronization of the width of
' the ExplorerBar's parent with that of the ExplorerBar.
Private Sub OnNavigationPaneExpandedStateChanging(ByVal explorerBar As UltraExplorerBar, ByVal e As NavigationPaneExpandedStateChangingEventArgsBase)
' If the ExplorerBar's Dock property is set to 'Fill',
' synchronize the width of the container with that of
' the ExplorerBar.
If explorerBar.Dock = DockStyle.Fill Then
Dim parentControl As Control = explorerBar.Parent
If Not parentControl Is Nothing Then parentControl.Width = e.PreferredWidth
End If
End Sub