Search code examples
silverlightxamldrag-and-dropsilverlight-toolkit

AllowDrop of *DragDropTarget not available in latest Silverlight toolkit 4


I know this has been discussed a number of times but I've been through all posts on the internet and nothing helped solve my problem.

I am making use of PanelDragDropTarget but can't get it to build when used AllowDrop property in my xaml. I've of course registered both namespaces but still get following error:

The property 'AllowDrop' does not exist on the type 'PanelDragDropTarget' in the XML namespace 'clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit'. C:\MainPage.xaml

or

The property 'AllowDrop' does not exist on the type 'PanelDragDropTarget' in the XML namespace 'clr-namespace:Microsoft.Windows;assembly=System.Windows.Controls.Toolkit'. c:\MainPage.xaml

The Toolkit library referenced is of version 4.0.5.0 and I also have referenced Toolkit.Internals. I am using VS 2008.


Solution

  • Sounds like you are actually working in Silverlight 3 not 4. The AllowDrop is a property of the UIElement added in Silverlight 4. It is related to the drag drop of file lists between the host system and silverlight. It is not related to the DragDrop framework supplied by the toolkit which focuses on the dragging of elements within Silverlight.

    You should instead be handling the DragEnter event of the PanelDragDropTarget and assigning your prefered value to the Effects propery of the eventargs in that event.