Version

PaneDragOver Event

Occurs during a pane drag operation when a new drop location is encountered
Syntax
'Declaration
 
Public Event PaneDragOver As EventHandler(Of PaneDragOverEventArgs)
public event EventHandler<PaneDragOverEventArgs> PaneDragOver
Event Data

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

PropertyDescription
Cursor Returns or sets the cursor that should be shown.
DragAction Returns a class that provides information about the operation being performed. This must be upcast to the appropriate type to obtain specific information about the operation.
Handled (Inherited from System.Windows.RoutedEventArgs)Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.
IsValidDragAction Returns or sets a boolean indicating whether the specified drag action is valid.
OriginalSource (Inherited from System.Windows.RoutedEventArgs)Gets the original reporting source as determined by pure hit testing, before any possible System.Windows.RoutedEventArgs.Source adjustment by a parent class.
Panes Returns the collection of panes that were dragged.
RoutedEvent (Inherited from System.Windows.RoutedEventArgs)Gets or sets the System.Windows.RoutedEventArgs.RoutedEvent associated with this System.Windows.RoutedEventArgs instance.
Source (Inherited from System.Windows.RoutedEventArgs)Gets or sets a reference to the object that raised the event.
Example
This sample demonstrates using the PaneDragOver event to determine whether a drag action is considered valid. The sample code assumes you have a XamDockManager with a similar configuration to what is demonstrated in the xaml snippet.

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.Windows.DockManager
Imports Infragistics.Windows.DockManager.Dragging
Imports Infragistics.Windows.DockManager.Events

Private Sub XamDockManager_PaneDragOver(ByVal sender As Object, ByVal e As PaneDragOverEventArgs)
    ' note: this event is only fired once for each unique 
    ' pane drag action. 

    ' the drag action provides information about the type 
    ' of action that will occur. the property is of the 
    ' base class - PaneDragAction - so you need to upcast 
    ' to the appropriate type to get additional information 
    ' 
    If TypeOf e.DragAction Is FloatPaneAction Then
        ' here we are preventing a drag operation from 
        ' changing a docked pane into a new floating pane. 
        ' the same effect would have been accomplished if 
        ' the AllowDockingFloating of one or more of the 
        ' panes in the e.Panes had been set to false. 
        e.IsValidDragAction = False
        ' note: by default this event will only fire for 
        ' valid drop locations. if you need to receive this 
        ' event for locations that are not valid (e.g. based 
        ' on properties of the pane(s) being dragged such as 
        ' the AllowDocking(Left|Right|Top|Bottom) properties) 
        ' then you need to set the 
        ' RaisePaneDragOverForInvalidLocations property of the 
        ' event args for the PaneDragStarting to true. 
        ' 
        'e.IsValidDragAction = true; 
    Else
    End If

    Dim sb As New System.Text.StringBuilder()
    sb.Append(e.DragAction.ToString())
    sb.Append(": ")

    ' you can see the panes that are being dragged 
    For Each pane As ContentPane In e.Panes
        sb.Append(pane.Header)
        sb.Append(",")
    Next

    System.Diagnostics.Debug.WriteLine(sb.ToString(), "PaneDragOver")

    ' the cursor property can be used to override the default 
    ' valid/invalid drop cursor that was specified in the 
    ' panedragstarting event. 
    If e.IsValidDragAction = False Then
        e.Cursor = Cursors.No
    End If

    ' mark the event handled so it doesn't keep bubbling 
    ' up the element tree 
    e.Handled = True
End Sub
using Infragistics.Windows.DockManager;
using Infragistics.Windows.DockManager.Dragging;
using Infragistics.Windows.DockManager.Events;

private void XamDockManager_PaneDragOver(object sender, PaneDragOverEventArgs e)
{
	// note: this event is only fired once for each unique 
	// pane drag action.

	// the drag action provides information about the type
	// of action that will occur. the property is of the 
	// base class - PaneDragAction - so you need to upcast
	// to the appropriate type to get additional information
	//
	if (e.DragAction is FloatPaneAction)
	{
		// here we are preventing a drag operation from 
		// changing a docked pane into a new floating pane. 
		// the same effect would have been accomplished if 
		// the AllowDockingFloating of one or more of the 
		// panes in the e.Panes had been set to false.
		e.IsValidDragAction = false;
	}
	else
	{
		// note: by default this event will only fire for
		// valid drop locations. if you need to receive this
		// event for locations that are not valid (e.g. based
		// on properties of the pane(s) being dragged such as
		// the AllowDocking(Left|Right|Top|Bottom) properties)
		// then you need to set the 
		// RaisePaneDragOverForInvalidLocations property of the
		// event args for the PaneDragStarting to true.
		//
		//e.IsValidDragAction = true;
	}

	System.Text.StringBuilder sb = new System.Text.StringBuilder();
	sb.Append(e.DragAction.ToString());
	sb.Append(": ");

	// you can see the panes that are being dragged
	foreach (ContentPane pane in e.Panes)
	{
		sb.Append(pane.Header);
		sb.Append(",");
	}

	System.Diagnostics.Debug.WriteLine(sb.ToString(), "PaneDragOver");

	// the cursor property can be used to override the default
	// valid/invalid drop cursor that was specified in the 
	// panedragstarting event.
	if (e.IsValidDragAction == false)
		e.Cursor = Cursors.No;

	// mark the event handled so it doesn't keep bubbling
	// up the element tree
	e.Handled = true;
}
<igDock:XamDockManager PaneDragOver="XamDockManager_PaneDragOver">
    
<igDock:XamDockManager.Panes>
        
<igDock:SplitPane>
            
<igDock:ContentPane Header="Test Pane" AllowDockingRight="False" />
        
</igDock:SplitPane>
        
<igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedRight">
            
<igDock:ContentPane Header="Don't Allow" AllowFloatingOnly="False" AllowDockingFloating="False"/>
        
</igDock:SplitPane>
    
</igDock:XamDockManager.Panes>
</igDock:XamDockManager>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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