Hi,I try to add a UserControl to DragSnapshotElement but nothing is visible. Do i something wrong?
Handler:
AddHandler source.DragStart, Sub(s As Object, e As DragDropStartEventArgs) Dim dragger As New Dragger e.DragSnapshotElement = dragger End Sub
UserControl:
<UserControl x:Class="WorkflowBrowser.Dragger" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400" Width="200" Height="200"> <Grid x:Name="LayoutRoot" Background="Blue"> </Grid> </UserControl>
The Textblock example from documentation works fine. I'm using v11.2.
Many thanks,
Tobias
Hi,
I suppose you need to call dragger.Measure() before do that, since it's not a part of the visual tree. Also your DragSnapshotElement will be ignored if you have applied a DragSource.DragTemplate.
Best regards.Plamen.
Calling Dragger.Measure don't change the result.
AddHandler source.DragStart, Sub(s1 As Object, e1 As DragDropStartEventArgs) Dim dragger As New Dragger dragger.Measure(Application.Current.RootVisual.RenderSize()) e1.DragSnapshotElement = dragger End Sub
I'm going to try a DragTemplate. Maybe this works:-)