[WPF] TextBox に Drag&Drop する方法
TextBox にファイルを Drag&Drop するには
まずは Drop イベントハンドラを追加しよう。
a.xaml
<TextBox Drop="TextBox_Drop" PreviewDragOver="TextBox_PreviewDragOver">
中身は
a.xaml.cs
(string[])e.Data.GetData(System.Windows.Data.Formats.FileDrop)
で取り出そう。
気をつけるべきは PreviewDragOver イベントハンドラーも必要。
Window なら必要ないんだけどね。
ハンドラの中身は、
a.xaml.cs
e.Handled = true;
とだけ書けばOKだ。
Author And Source
この問題について([WPF] TextBox に Drag&Drop する方法), 我々は、より多くの情報をここで見つけました https://qiita.com/enakko_net/items/84f60965f575cb916b5a著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .