mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-08 07:56:07 +02:00
Replace various WPF include files with content (#1335)
* net-current-v30plus-md.md * net-current-v40plus-md.md * tla2sharptla-ui-md.md * tla2sharptla-uiautomation-md.md * tla2sharptla-winclient-md.md * tla2sharptla-xaml-md.md * tlasharptla-ui-md.md * tlasharptla-uiautomation-md.md * tlasharptla-winclient-md.md * tlasharptla-xaml-md.md * fix warnings
This commit is contained in:
@@ -16,7 +16,7 @@ helpviewer_keywords:
|
||||
ms.assetid: 1a5b27b0-0ac5-4cdf-86c0-86ac0271fa64
|
||||
---
|
||||
# Drag and Drop Overview
|
||||
This topic provides an overview of drag-and-drop support in [!INCLUDE[TLA#tla_winclient](../../../includes/tlasharptla-winclient-md.md)] applications. Drag-and-drop commonly refers to a method of data transfer that involves using a mouse (or some other pointing device) to select one or more objects, dragging these objects over some desired drop target in the [!INCLUDE[TLA#tla_ui](../../../includes/tlasharptla-ui-md.md)], and dropping them.
|
||||
This topic provides an overview of drag-and-drop support in user interface (UI), and dropping them.
|
||||
|
||||
<a name="Drag_and_Drop_Support"></a>
|
||||
## Drag-and-Drop Support in WPF
|
||||
@@ -26,9 +26,9 @@ This topic provides an overview of drag-and-drop support in [!INCLUDE[TLA#tla_wi
|
||||
|
||||
The particular actions performed during a drag-and-drop operation are application specific, and often determined by context. For example, dragging a selection of files from one folder to another on the same storage device moves the files by default, whereas dragging files from a Universal Naming Convention (UNC) share to a local folder copies the files by default.
|
||||
|
||||
The drag-and-drop facilities provided by [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] are designed to be highly flexible and customizable to support a wide variety of drag-and-drop scenarios. Drag-and-drop supports manipulating objects within a single application, or between different applications. Dragging-and-dropping between [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] applications and other Windows applications is also fully supported.
|
||||
The drag-and-drop facilities provided by WPF are designed to be highly flexible and customizable to support a wide variety of drag-and-drop scenarios. Drag-and-drop supports manipulating objects within a single application, or between different applications. Dragging-and-dropping between WPF applications and other Windows applications is also fully supported.
|
||||
|
||||
In [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)], any <xref:System.Windows.UIElement> or <xref:System.Windows.ContentElement> can participate in drag-and-drop. The events and methods required for drag-and-drop operations are defined in the <xref:System.Windows.DragDrop> class. The <xref:System.Windows.UIElement> and <xref:System.Windows.ContentElement> classes contain aliases for the <xref:System.Windows.DragDrop> attached events so that the events appear in the class members list when a <xref:System.Windows.UIElement> or <xref:System.Windows.ContentElement> is inherited as a base element. Event handlers that are attached to these events are attached to the underlying <xref:System.Windows.DragDrop> attached event and receive the same event data instance. For more information, see the <xref:System.Windows.UIElement.Drop?displayProperty=nameWithType> event.
|
||||
In WPF, any <xref:System.Windows.UIElement> or <xref:System.Windows.ContentElement> can participate in drag-and-drop. The events and methods required for drag-and-drop operations are defined in the <xref:System.Windows.DragDrop> class. The <xref:System.Windows.UIElement> and <xref:System.Windows.ContentElement> classes contain aliases for the <xref:System.Windows.DragDrop> attached events so that the events appear in the class members list when a <xref:System.Windows.UIElement> or <xref:System.Windows.ContentElement> is inherited as a base element. Event handlers that are attached to these events are attached to the underlying <xref:System.Windows.DragDrop> attached event and receive the same event data instance. For more information, see the <xref:System.Windows.UIElement.Drop?displayProperty=nameWithType> event.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> OLE drag-and-drop does not work while in the Internet zone.
|
||||
@@ -50,9 +50,9 @@ This topic provides an overview of drag-and-drop support in [!INCLUDE[TLA#tla_wi
|
||||
The source and target of a drag-and-drop operation are UI elements; however, the data that is actually being transferred typically does not have a visual representation. You can write code to provide a visual representation of the data that is dragged, such as occurs when dragging files in Windows Explorer. By default, feedback is provided to the user by changing the cursor to represent the effect that the drag-and-drop operation will have on the data, such as whether the data will be moved or copied.
|
||||
|
||||
### Drag-and-Drop Effects
|
||||
Drag-and-drop operations can have different effects on the transferred data. For example, you can copy the data or you can move the data. [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] defines a <xref:System.Windows.DragDropEffects> enumeration that you can use to specify the effect of a drag-and-drop operation. In the drag source, you can specify the effects that the source will allow in the <xref:System.Windows.DragDrop.DoDragDrop%2A> method. In the drop target, you can specify the effect that the target intends in the <xref:System.Windows.DragEventArgs.Effects%2A> property of the <xref:System.Windows.DragEventArgs> class. When the drop target specifies its intended effect in the <xref:System.Windows.DragDrop.DragOver> event, that information is passed back to the drag source in the <xref:System.Windows.DragDrop.GiveFeedback> event. The drag source uses this information to inform the user what effect the drop target intends to have on the data. When the data is dropped, the drop target specifies its actual effect in the <xref:System.Windows.DragDrop.Drop> event. That information is passed back to the drag source as the return value of the <xref:System.Windows.DragDrop.DoDragDrop%2A> method. If the drop target returns an effect that is not in the drag sources list of `allowedEffects`, the drag-and-drop operation is cancelled without any data transfer occurring.
|
||||
Drag-and-drop operations can have different effects on the transferred data. For example, you can copy the data or you can move the data. WPF defines a <xref:System.Windows.DragDropEffects> enumeration that you can use to specify the effect of a drag-and-drop operation. In the drag source, you can specify the effects that the source will allow in the <xref:System.Windows.DragDrop.DoDragDrop%2A> method. In the drop target, you can specify the effect that the target intends in the <xref:System.Windows.DragEventArgs.Effects%2A> property of the <xref:System.Windows.DragEventArgs> class. When the drop target specifies its intended effect in the <xref:System.Windows.DragDrop.DragOver> event, that information is passed back to the drag source in the <xref:System.Windows.DragDrop.GiveFeedback> event. The drag source uses this information to inform the user what effect the drop target intends to have on the data. When the data is dropped, the drop target specifies its actual effect in the <xref:System.Windows.DragDrop.Drop> event. That information is passed back to the drag source as the return value of the <xref:System.Windows.DragDrop.DoDragDrop%2A> method. If the drop target returns an effect that is not in the drag sources list of `allowedEffects`, the drag-and-drop operation is cancelled without any data transfer occurring.
|
||||
|
||||
It is important to remember that in [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)], the <xref:System.Windows.DragDropEffects> values are only used to provide communication between the drag source and the drop target regarding the effects of the drag-and-drop operation. The actual effect of the drag-and-drop operation depends on you to write the appropriate code in your application.
|
||||
It is important to remember that in WPF, the <xref:System.Windows.DragDropEffects> values are only used to provide communication between the drag source and the drop target regarding the effects of the drag-and-drop operation. The actual effect of the drag-and-drop operation depends on you to write the appropriate code in your application.
|
||||
|
||||
For example, the drop target might specify that the effect of dropping data on it is to move the data. However, to move the data, it must be both added to the target element and removed from the source element. The source element might indicate that it allows moving the data, but if you do not provide the code to remove the data from the source element, the end result will be that the data is copied, and not moved.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user