我想實現在WPF中拖/放技工,但它沒有工作... 使用Windows窗體它的工作,滴在WPF ...C#:拖放(RichTextBox中)
第一我將AllowDrop設置爲True。在Windows窗體中,您可以將項目拖動到richtextbox中並且光標發生更改。
使用WPF ....沒有任何反應。
nexT點:實現DragEnter和DragDrop Methodes。 我做了像在線手冊說的那樣。 (好吧,我不得不嘗試更多的東西,因爲DragDrop不存在於WPF中) 我認爲所有的拖放教程僅適用於Windowsforms,WPF沒有任何內容...
richtextbox ?如果我將其更改爲「allowDrop」 - 沒有任何反應。遊標仍然是一個不允許的符號。
希望有人可以從教程幫助:)
Examplecode我讀:
richTextBox1.AllowDrop = true;
void richTextBox1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.None;
if (e.Data.GetDataPresent(DataFormats.XXX))
{
e.Effect = DragDropEffects.Copy;
}
}
void richTextBox1_DragDrop(object sender, DragEventArgs e)
{
//intert in richtextbox ...
richTextBox1.methodeXY();
}