ToolStripItem::AllowDrop Property

 

Gets or sets a value indicating whether drag-and-drop and item reordering are handled through events that you implement.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
[BrowsableAttribute(false)]
property bool AllowDrop {
	virtual bool get();
	virtual void set(bool value);
}

Property Value

Type: System::Boolean

true if drag-and-drop operations are allowed in the control; otherwise, false. The default is false.

Exception Condition
ArgumentException

AllowDrop and AllowItemReorder are both set to true.

Set the AllowDrop property to true and set the AllowItemReorder property to false to respond to drag-and-drop behavior you have defined in the ToolStripItem::DragEnter, ToolStripItem::DragLeave, and ToolStripItem::DragDrop events.

Set the AllowDrop property to false and set the AllowItemReorder property to true to cause the ToolStripItem class to handle drag-and-drop and item reordering privately.

Setting both the AllowDrop and the AllowItemReorder properties to true throws an exception.

The following code example demonstrates how to set the AllowDrop property. This code example is part of a larger example provided for the ToolStripItem class.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: