I have a ListBox in a Dockpane from where I want to Drag/Drop items onto a Map. When starting the Drag the StartDrag method is triggered. However, neither OnDragOver or OnDrop is ever triggered thereafter.
My XAML file has a reference to the DragDrop namespace and the ListBox is set as drag source
xmlns:dragDrop="clr-namespace:ArcGIS.Desktop.Framework.DragDrop;assembly=ArcGIS.Desktop.Framework"
<ListBox x:Name="DataLayerList" ItemsSource="{Binding LayersFiltered, Mode=TwoWay}" dragDrop:DragDrop.IsDragSource="True" dragDrop:DragDrop.DragHandler="{Binding}"/>
My ViewModel implements IDragSource and here is my Drag&Drop part. Where OnDragOver and OnDrop is never triggered when I pull an item from the ListBox onto a Map.
private List<string> _dragLayerGuids;
public void StartDrag(DragInfo dragInfo)
{
IEnumerable sourceItems = dragInfo.SourceItems;
if (sourceItems == null)
{
return;
}
_dragLayerGuids = new List<string>();
foreach (ThemeLayer layer in sourceItems)
{
_dragLayerGuids.Add(layer.Id);
}
}
public override void OnDragOver(DropInfo dropInfo)
{
dropInfo.Effects = DragDropEffects.All;
}
public override void OnDrop(DropInfo dropInfo)
{
if (_dragLayerGuids != null)
{
AddService(_dragLayerGuids);
}
}
What am I missing to make this work?