Version

BeforeToggleDockState Event

Occurs before a pane's dock state is toggled from Docked to Floating or vice versa.
Syntax
'Declaration
 
Public Event BeforeToggleDockState As CancelablePaneEventHandler
public event CancelablePaneEventHandler BeforeToggleDockState
Event Data

The event handler receives an argument of type CancelablePaneEventArgs containing data related to this event. The following CancelablePaneEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Pane DockablePaneBase instance associated with the event. This property is read-only.
Example
The following code demonstrates how to selectively control which panes may be toggled between their docked and floating states. This can also be accomplished using the PaneSettings's PaneDoubleClickAction property.

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.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinDock

Private Sub ultraDockManager1_BeforeToggleDockState(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDock.CancelablePaneEventArgs) Handles ultraDockManager1.BeforeToggleDockState

    ' The BeforeToggleDockState is invoked when the user
    ' double clicks on the caption or tab item for a pane
    ' but before the window has changed position from
    ' floating to docked (or vice versa).
    ' The Cancel parameter can be set to true to cancel
    ' the change.

    ' Assuming a structure of:
    ' DockArea1
    '		Child1
    '		Child2
    ' DockArea2
    '		Child3
    ' With the following code, the user could double click
    ' on the caption of DockArea1, DockArea2, or Child3
    ' to change they're state from floating to docked.
    '

    ' Do not allow the members of a group to have their 
    ' state toggled from docked to floating or floating 
    ' to docked if the pane has siblings
    '
    If (Not e.Pane.Parent Is Nothing AndAlso e.Pane.Parent.Panes.Count > 1) Then
        e.Cancel = True
    End If

End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDock;
using System.Diagnostics;

private void ultraDockManager1_BeforeToggleDockState(object sender, Infragistics.Win.UltraWinDock.CancelablePaneEventArgs e)
{

	// The BeforeToggleDockState is invoked when the user
	// double clicks on the caption or tab item for a pane
	// but before the window has changed position from
	// floating to docked (or vice versa).
	// The Cancel parameter can be set to true to cancel
	// the change.

	// Assuming a structure of:
	// DockArea1
	//		Child1
	//		Child2
	// DockArea2
	//		Child3
	// With the following code, the user could double click
	// on the caption of DockArea1, DockArea2, or Child3
	// to change they're state from floating to docked.
	//

	// Do not allow the members of a group to have their 
	// state toggled from docked to floating or floating 
	// to docked if the pane has siblings
	//
	if (e.Pane.Parent != null && e.Pane.Parent.Panes.Count > 1)
		e.Cancel = true;

}
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