Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
RenderTransform on Drag?
posted

Is it possible to attach a RenderTransform so that when an object is being dragged, its "ghost" can take the same transformations (rotation, in my case) as the actual object?

  • 8831
    posted

    It is possible to set the DragSource.DragTemplate with data template that can contain anything. You also can subscribe for DragSource.DragStart, DragSource.DragEnter, DragSource.DragOver or DragSource.DragLeave events and use the event handlers to set different data templates for the different scenarios. If you need the snapshot of the actual object you can set binding to DragImage property of underlying DragObject instance.

     

    <DataTemplate x:Key="dragTemplate">

          <Border BorderBrush="Gray" BorderThickness="1">

                <ContentControl Content="{Binding DragImage}"/>

          </Border>

    </DataTemplate>

    For example, here you can apply some animations to the border element. The DragObject expose the Data property as well.

     

    I hope that will help.

     

    Best regards.

    PPilev.