1
votes

Is there anyway to customize a DragPreview in WPF when using Telerik RadTreeView?

I've set the IsDragPreviewEnabled to true, but as you can see from the image, all it does is display the namespace in a button rather than a preview of the actual item being dragged (which in this case is a row of a grid.

enter image description here

I'm happy to not necessarily show a preview of the item I'm dragging - it would be good enough to show a standard image, just to give the user some feedback that the drag was taking place.

Any ideas how I could achieve this?

Thanks

1

1 Answers

0
votes

You need to define a data template for the respective data type in resources of the window

example

<Window x:Class="CSharpWPF.View"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow"
        xmlns:dto="clr-namespace:System.DataTransferObjects.ProcessMapItems">
    <Window.Resources>
        <DataTemplate DataType="{x:Type dto:ActivityItemDto}">
            <Image Source="itemImage.jpg" />
        </DataTemplate>
    </Window.Resources>
    ...
</Window>

this will show the image in the drag container instead of the standard text. you may need to restrict the size of the image if needed.

above is just an example you may need to provide the correct data type, I made assumption based on the screen in the question.