IDropHandlerProvider Interface
Creates an IDropHandler for a IWpfTextView.
Namespace: Microsoft.VisualStudio.Text.Editor.DragDrop
Assembly: Microsoft.VisualStudio.Text.UI.Wpf (in Microsoft.VisualStudio.Text.UI.Wpf.dll)
Syntax
'Déclaration
Public Interface IDropHandlerProvider
public interface IDropHandlerProvider
public interface class IDropHandlerProvider
type IDropHandlerProvider = interface end
public interface IDropHandlerProvider
The IDropHandlerProvider type exposes the following members.
Methods
Name | Description | |
---|---|---|
GetAssociatedDropHandler | Gets an IDropHandler for a specified IWpfTextView. |
Top
Remarks
This is a MEF component part, and must be exported as follows:
[Export(typeof(IDropHandlerProvider))]
It must also have one or more DropFormatAttribute attributes.
For example, if the provided IDropHandler handles both text and RTF formats, two DropFormatAttribute annotations are necessary:
[Export(typeof(IDropHandlerProvider))]
[DropFormat("Rich Text Format")]
[DropFormat("Text")]
IDropHandler objects are used to handle drag and drop operations for different data formats and to act as extension points for customizing drop operations. If you provide a IDropHandler, you must export a provider in order to instantiate the IDropHandler with the required context.
At runtime the editor looks for these exports, and calls the GetAssociatedDropHandler method in order to activate the IDropHandler associated with the provider. That IDropHandler will then be notified when a drag and drop operation of the corresponding data format has been requested. All other tasks, such as capturing mouse events, scrolling the view, etc., are handled by the editor.
DropFormatAttribute objects specify the data formats that the associated IDropHandler can handle. These formats are specified by string keys and correspond to the standard data formats defined by the IDataObject interface. For example, to handle RTF content you must specify [DropFormat("Rich Text Format")], as defined in the IDataObject interface.
A single IDataObject can contain multiple data formats, so that multiple drop handlers might be available to handle the formats. In this case, the data is delegated to the drop handlers according to a predefined set of priorities.
The format priorities are as follows, from the highest to the lowest priority:
Any custom format
FileDrop
EnhancedMetafile
WaveAudio
Riff
Dif
Locale
Palette
PenData
Serializable
SymbolicLink
Xaml
XamlPackage
Tiff
Bitmap
Dib
MetafilePicture
CommaSeparatedValue
StringFormat
Html
Rtf
UnicodeText
OemText
Text