by robotix1986
25. October 2009 21:41
Hi Folks,
This time, back to WPF. I thought of using the drag & drop functionality in WPF. Just some experiments. Half-way through my coding. A DCR you may say.
I went through the
WPF documentation on MSDN, which seemed pretty straight-forward. I added the AllowDrop="True" tag to a ListView control for which I needed this feature. And I Compiled it.
So far so good. Then I tried dropping a file onto the ListView. However, no luck. All I got is the forbidden icon.
Hmm. Maybe it's some logic in my code that's preventing this from happening. I created a sample app with just the single ListBox. Still the same result.
I searched a couple of blogs. All examples were either similar or exactly the same as mine.
http://www.kirupa.com/blend_wpf/drag_drop_files_wpf_pg1.htm
http://www.codeproject.com/KB/WPF/WPF_Drag_And_Drop_Sample.aspx
http://msdn.microsoft.com/en-us/library/bb295243.aspx
Solution
Next, I started searching for issues with WPF drag & drop. No luck here either. Finally, found that Vista has an issue... or a "By Design" thing... which says that "Vista prevents lower security applications from giving data (and potentially hurting) higher level applications". It seems that same is the case with Windows 7.
Bingo... I was running VS and debugging as an Administrator. Running the application outside of VS makes it work perfectly fine. And thus I found my solution and my app it's drag & drop feature.
Till my next post
Regards,
AlD