Reputation: 97
I want to implement the default DragDrop feature of WPF. I created a Rectangle, and when I start a dragging from that, the cursor changes automatically based on the CursorEffect of the element under it. The cursor changes correctly everywhere. Next to this Rectangle I have a Telerik TreeListView, and I created custom DataTemplates for its cells, with canvases and rectangles on those. I implemented the same drag start on these rectangles as the rectangle outside of the TreeListView. But when I move the cursor, it remains the default arrow cursor. I assume, the telerik overrides the cursor handling, and I don't know how to disable it. The event handlers work fine everywhere, inside of the Telerik control, and outside of it too. When I tried to change the cursor type in an eventhandler of a Rectangle in my DataTemplate, the cursor only changed for a moment, and it changed back to default immediately. I used this code to start the drag:
private void TesztRectangle_MouseMove( object sender, MouseEventArgs e )
{
if ( e.LeftButton == MouseButtonState.Pressed )
{
Trace.WriteLine( "create object" );
DataObject data = new DataObject();
data.SetData( DataFormats.StringFormat, "alma" );
data.SetData( "Double", 82 );
// Initiate the drag-and-drop operation.
DragDrop.DoDragDrop( this, data, DragDropEffects.Copy );
}
e.Handled = true;
}
Upvotes: 0
Views: 47