IDropHandlerProvider 介面
建立 IWpfTextView 的 IDropHandler。
命名空間: Microsoft.VisualStudio.Text.Editor.DragDrop
組件: Microsoft.VisualStudio.Text.UI.Wpf (在 Microsoft.VisualStudio.Text.UI.Wpf.dll 中)
語法
'宣告
Public Interface IDropHandlerProvider
public interface IDropHandlerProvider
public interface class IDropHandlerProvider
type IDropHandlerProvider = interface end
public interface IDropHandlerProvider
IDropHandlerProvider 類型會公開下列成員。
方法
名稱 | 描述 | |
---|---|---|
GetAssociatedDropHandler | 為指定的 IWpfTextView 取得 IDropHandler。 |
回頁首
備註
這是 MEF 元件的組件,並必須匯出,如下所示:
[Export(typeof(IDropHandlerProvider))]
它也必須至少有一個DropFormatAttribute屬性。
比方說,如果提供IDropHandler處理文字和 RTF 格式、 二DropFormatAttribute是必要的註解:
[Export(typeof(IDropHandlerProvider))]
[DropFormat("Rich Text Format")]
[DropFormat("Text")]
IDropHandler物件用來處理拖拖放作業的不同資料格式,或做為用來自訂拖放作業的擴充點。 如果您提供IDropHandler,您必須匯出以具現化的提供者IDropHandler與所需的內容。
會在執行階段編輯器] 中尋找這些匯出和呼叫GetAssociatedDropHandler方法,以啟動IDropHandler提供者相關聯。 IDropHandler再時將會通知已要求相對應的資料格式的拖放作業。 編輯器會處理所有其他工作,例如捕捉滑鼠事件,捲動檢視、 等等。
DropFormatAttribute物件指定的資料格式相關的IDropHandler能處理。 這些格式所指定的字串索引鍵,並對應至所定義的標準的資料格式IDataObject介面。 比方說,如果要控制代碼的 RTF 內容必須指定[DropFormat("Rich Text Format")]中所定義、 IDataObject介面。
單一個IDataObject可以包含多個資料格式,使多個拖放處理常式可能是可用來處理的格式。 在此情況下,資料被委派給拖放處理常式根據一組預先定義的優先順序。
格式的優先順序,如下所示,是從最高額排到最低優先權:
任何自訂的格式
FileDrop
EnhancedMetafile
WaveAudio
Riff
Dif
地區設定
Palette
PenData
可序列化
SymbolicLink
Xaml
XamlPackage
Tiff
點陣圖
Dib
MetafilePicture
CommaSeparatedValue
StringFormat
Html
Rtf 格式
UnicodeText
OemText
文字