I have a listbox of things that I want to be able to drag, I have successfully gotten it to work by using a DataTemplate for ListBox.ItemTemplate, which sets DragDropManager.DragSource on the root element of the DataTemplate. But the problem is that if the listbox is wider than the DataTemplate then the user must click on my textblock exactly, if they click to the right of the textblock then they cant drag.
This is what I have right now:
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<ig:DragDropManager.DragSource>
<ig:DragSource IsDraggable="True" Drop="SearchResults_Drop"
DragStart="DragSource_DragStart"/>
</ig:DragDropManager.DragSource>
<TextBlock Text="{Binding}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
I would like to apply the DragSource to the ListBoxItem itself so that they can click anywhere on the item to drag it, I was trying to do that through a style, but I get an error saying Drop is not a routed event.
<ListBox.ItemContainerStyle>
<Style>
<Setter Property="ig:DragDropManager.DragSource">
<Setter.Value>
<ig:DragSource IsDraggable="True" Drop="SearchResults_Drop" DragStart="DragSource_DragStart"/>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
Compiles with error: error MC6006: Infragistics.DragDrop.DragSource.Drop="SearchResults_Drop" is not valid. 'Drop' must be a RoutedEvent registered with a name that ends with the keyword "Event"
What is the correct way to make the ListBoxItem a DragSource?