Visual Studio 2010 WPF Project ran in debug or release will not allow drag and drop to any control
Asked Answered
B

1

12

I had started a question here: WPF drag and drop files onto TreeView from windows explorer but I just discovered this is a totally different problem that what I thought it was.

I have an extremely simple test case.

I was using a treeview but if I use a simple listbox with no code just the following xaml

<StackPanel Orientation="Vertical">
    <ListBox Height="312" Background="#FFBDD6FF" AllowDrop="True"/>
</StackPanel>

If I run the project in expression blend and drag a file over the listbox I see the arrow and the little square below it that incdicates you can drag and drop.

If I run the same project in visual studio and drag a file over the listbox I get a black circle with a line through it.

What could be wrong with my computer or code that is causing that?

Backhander answered 20/9, 2011 at 13:26 Comment(1)
I just tested your code exactly on my computer and I get the square in Visual Studio. I would apply all services packs and patches and reboot.Thirsty
V
27

Is it possible that you are running Visual Studio as Administrator and Expression Blend normally?

Vivacious answered 20/9, 2011 at 13:28 Comment(5)
Yes. Does running as administrator interfere with drag and drop?Backhander
Yes it does, try starting a notepad.exe instance and drag&drop a file from explorer. See that it will open. Now try the same with an instance started as administrator, which will not open the fileVivacious
That explains all my problems for the last day and a half then. I also found this bug submission on Microsoft Connect: connect.microsoft.com/VisualStudio/feedback/details/537964/…. I guess if notepad has the same behaivior it isn't really a bug. Some kind of security thing I suppose?Backhander
No this is not a bug, elevated (in your case VisualStudio) and non-elevated (in your case Explorer) processes are shielded from direct communication with each other. Welcome to the wonderfull world uf UACVivacious
It is called UIPI, take the first google hit. You can't hijack the privileges of an elevated program with D+D. Makes sense, no workaround. And not a real problem to your user.Vermicide

© 2022 - 2024 — McMap. All rights reserved.