Version

NavigationPaneExpandedState Property

Returns/sets whether the Outlook Navigation Pane is expanded or collapsed. Applicable only when the control's Style property is set to 'OutlookNavigationPane'.
Syntax
'Declaration
 
Public Property NavigationPaneExpandedState As NavigationPaneExpandedState
public NavigationPaneExpandedState NavigationPaneExpandedState {get; set;}
Remarks

Important note: When the ExplorerBar's System.Windows.Forms.Control.Dock property is set to a value other than 'None', the collapsible navigation pane feature will not function properly. This is because the feature relies on setting the control's System.Windows.Forms.Control.Width property, which is not supported for all values of the Dock property. This limitation can be overcome, however, using the public object model; the end developer can handle the NavigationPaneExpanding and NavigationPaneCollapsing events, and set the width of the ExplorerBar's System.Windows.Forms.Control.Parent to the same value as that of the NavigationPaneExpandedStateChangingEventArgsBase.PreferredWidth property of the event arguments.

When the NavigationPaneExpansionMode property is set to 'OnButtonClick' or 'OnButtonClickOrSizeChanged', and the NavigationPaneExpansionButtonUIElement is clicked by the end user, the value of the NavigationPaneExpandedState property is toggled, i.e., transitions from 'Expanded' to 'Collapsed', or from 'Collapsed' to 'Expanded'. The navigation pane's expanded state is also changed when the NavigationPaneExpansionMode property is set to 'OnSizeChanged' or 'OnButtonClickOrSizeChanged' and the width of the control "crosses" the threshold defined by the NavigationPaneExpansionThreshold property. The NavigationPaneExpandedState property can be set programmatically to cause the same change in the navigation pane's expanded state. When the value of the property changes to 'Collapsed', the control's width is set to the value defined by the NavigationPaneExpansionThresholdResolved property; when it changes to 'Expanded', the width is set to the value it had the last time it was in the expanded state.

Note: The NavigationPaneExpandedState property is only applicable when the control's Style property is set to 'OutlookNavigationPane'.

Note: Changing the value of the NavigationPaneExpandedState property to 'Expanded' causes the and events to fire. Changing the value to 'Callapsed' causes the and events to fire.

Note: Changing the value of the NavigationPaneExpansionMode property to 'None' will cause the value of the NavigationPaneExpandedState property to revert to 'Expanded'.

Example
The following code sample demonstrates how to use the NavigationPaneExpanding and NavigationPaneCollapsing events to handle the expanding and collapsing of the ExplorerBar when it is docked inside a Panel control:

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

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
using Infragistics.Win;
using Infragistics.Win.UltraWinExplorerBar;
using System.Diagnostics;

		//	Handles the Form's 'Load' event.
		private void Form1_Load(object sender, System.EventArgs e)
		{
			//	Add the ExplorerBar to the Panel's Controls collection
			this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] { this.ultraExplorerBar1 } );

			//	Dock the Panel control to the left side of the form
			this.panel1.Dock = System.Windows.Forms.DockStyle.Left;

			//   Set the NavigationPaneExpansionMode property to 'OnButtonClickOrSizeChanged'
			//   so that the navigation pane's expanded state is changed on both button clicks
			//   and control resizing.
			this.ultraExplorerBar1.NavigationPaneExpansionMode = NavigationPaneExpansionMode.OnButtonClickOrSizeChanged;

			//   Set the NavigationPaneExpansionThreshold property so that resizing the
			//   width smaller than 50 pixels causes the navigation pane to collapse.
			this.ultraExplorerBar1.NavigationPaneExpansionThreshold = 50;

			//	Hook the NavigationPaneExpanding and NavigationPaneCollapsing events
			this.ultraExplorerBar1.NavigationPaneExpanding += new Infragistics.Win.UltraWinExplorerBar.NavigationPaneExpandingEventHandler(this.ultraExplorerBar1_NavigationPaneExpanding);
			this.ultraExplorerBar1.NavigationPaneCollapsing += new Infragistics.Win.UltraWinExplorerBar.NavigationPaneCollapsingEventHandler(this.ultraExplorerBar1_NavigationPaneCollapsing);		

			//	Set the NavigationPaneExpandedState to 'Collapsed' so that the ExplorerBar is initially collapsed
			this.ultraExplorerBar1.NavigationPaneExpandedState = NavigationPaneExpandedState.Collapsed;
		}

		//	Handles the ExplorerBar's 'NavigationPaneCollapsing' event.
		private void ultraExplorerBar1_NavigationPaneCollapsing(object sender, Infragistics.Win.UltraWinExplorerBar.NavigationPaneCollapsingEventArgs e)
		{
			UltraExplorerBar explorerBar = sender as UltraExplorerBar;
			this.OnNavigationPaneExpandedStateChanging( explorerBar, e );
		}

		//	Handles the ExplorerBar's 'NavigationPaneExpanding' event.
		private void ultraExplorerBar1_NavigationPaneExpanding(object sender, Infragistics.Win.UltraWinExplorerBar.NavigationPaneExpandingEventArgs e)
		{
			UltraExplorerBar explorerBar = sender as UltraExplorerBar;
			this.OnNavigationPaneExpandedStateChanging( explorerBar, e );		
		}

		//	Helper method which handles synchronization of the width of
		//	the ExplorerBar's parent with that of the ExplorerBar.
		private void OnNavigationPaneExpandedStateChanging( UltraExplorerBar explorerBar, NavigationPaneExpandedStateChangingEventArgsBase e )
		{
			//	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 )
			{
				Control parentControl = explorerBar.Parent;
				if ( parentControl != null )
					parentControl.Width = e.PreferredWidth;
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also