Partager via


IDropHandlerProvider Interface

Definition

Creates an IDropHandler for a IWpfTextView.

public interface class IDropHandlerProvider
public interface class IDropHandlerProvider
__interface IDropHandlerProvider
public interface IDropHandlerProvider
type IDropHandlerProvider = interface
Public Interface IDropHandlerProvider

Remarks

This is a MEF component part, and must be exported with the [Export(typeof(IDropHandlerProvider))] attribute. It must also have one or more [DropFormat("FormatKind")] 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 various data formats and act as extension points for customizing drop operations.

If you provide a IDropHandler, you must export a factory service in order to instantiate the IDropHandler with the required context. At runtime the editor looks for these exports, and calls the GetAssociatedDropHandler method to activate the IDropHandler associated with the factory service. The 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

Methods

GetAssociatedDropHandler(IWpfTextView)

Gets an IDropHandler for a specified IWpfTextView.

Applies to