Version

BeforeToolDragBegin Event

Occurs before a tool drag operation has started.
Syntax
'Declaration
 
Public Event BeforeToolDragBegin As CancelableToolEventHandler
public event CancelableToolEventHandler BeforeToolDragBegin
Event Data

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

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Tool The tool.
Example
The following sample code demonstrates how to use the BeforeToolDragBegin and AfterToolDragEnd events.

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.UltraWinToolbars

	Private Sub UltraToolbarsManager1_BeforeToolDragBegin(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.CancelableToolEventArgs) Handles UltraToolbarsManager1.BeforeToolDragBegin
		' The 'BeforeToolDragBegin' is invoked when a tool drag
		' operation is about to be cancelled and provides a way to
		' prevent certain tools from being repositioned.
		' e.g. allow a user to create a new tool but not
		' reposition a tool once its been placed
		If Not e.Tool.OwnerIsNull And Not e.Tool.OwnerIsToolbarsManager Then
			e.Cancel = True
		End If
	End Sub

	Private Sub UltraToolbarsManager1_AfterToolDragEnd(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.AfterToolDragEventArgs) Handles UltraToolbarsManager1.AfterToolDragEnd
		' The 'AfterToolDragEnd' is invoked after a tool drag operation
		' is complete and provides a reference to the tool after
		' the drag operation as well as an indication of what happened.
		' Note that when a tool is removed, it will not longer have
		' a reference to the toolbarsmanager or its former owner. To
		' reference the toolbarsmanager, you can use the sender of the
		' event.
		System.Diagnostics.Debug.WriteLine(String.Format("The drag of tool {0} has ended with an action of {1}", e.Tool.Key, e.DragAction))
	End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinToolbars;

		private void ultraToolbarsManager1_BeforeToolDragBegin(object sender, Infragistics.Win.UltraWinToolbars.CancelableToolEventArgs e)
		{
			// The 'BeforeToolDragBegin' is invoked when a tool drag
			// operation is about to be cancelled and provides a way to
			// prevent certain tools from being repositioned.

			// e.g. allow a user to create a new tool but not
			// reposition a tool once its been placed
			if (!e.Tool.OwnerIsNull && !e.Tool.OwnerIsToolbarsManager)
				e.Cancel = true;
		}

		private void ultraToolbarsManager1_AfterToolDragEnd(object sender, Infragistics.Win.UltraWinToolbars.AfterToolDragEventArgs e)
		{
			// The 'AfterToolDragEnd' is invoked after a tool drag operation
			// is complete and provides a reference to the tool after
			// the drag operation as well as an indication of what happened.
			// Note that when a tool is removed, it will not longer have
			// a reference to the toolbarsmanager or its former owner. To
			// reference the toolbarsmanager, you can use the sender of the
			// event.
			System.Diagnostics.Debug.WriteLine(	string.Format("The drag of tool {0} has ended with an action of {1}", e.Tool.Key, e.DragAction) );
		}
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