c# - Cannot drag text into a WPF window -
c# - Cannot drag text into a WPF window -
i'm trying set wpf window can take different types of info via drag , drop
. if create new project , set window following:
<window x:class="dropshare.window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="window1" height="300" width="300" allowdrop="true" dragenter="window_dragenter"> <grid> </grid> </window>
and set code-behind to:
public partial class window1 : window { public window1() { initializecomponent(); } private void window_dragenter(object sender, drageventargs e) { } }
i ever dragenter
firing files. never fires else - text, images, etc.
is there i'm missing? tutorials i've read have seemed suggest that's needed dragenter
event handler let's me state accept.
so code works fine me. seek this...
in window:
<label background="purple" horizontalalignment="center" verticalalignment="center" content="drag here!" mousedown="label_mousedown"/>
and in code behind:
private void label_mousedown(object sender, mousebuttoneventargs e) { dragdrop.dodragdrop(this, "this test", dragdropeffects.all); }
then drag label window , see if event fires.
if works, may have permissions level between visual studio , outside environment (possibly).
see:
http://superuser.com/questions/59051/drag-and-drop-file-into-application-under-run-as-administrator
c# wpf drag-and-drop window
Comments
Post a Comment