I have included images on a canvas on my WPF user control:
<Canvas>
<Thumb Canvas.Left="19" Canvas.Top="-7" Canvas.ZIndex="99" DragDelta="Thumb_DragDelta">
<Thumb.Template>
<ControlTemplate>
<Image Name="Image1" Source="/Images/Image1.png" Height="120" Width="242" Margin="63,180,696,393" />
</ControlTemplate>
</Thumb.Template>
</Thumb>
<Thumb Canvas.Left="52" Canvas.Top="6" DragDelta="Thumb_DragDelta">
<Thumb.Template>
<ControlTemplate>
<Image Name="Image2" Source="/Images/Image2.png" Height="120" Width="205" Margin="760,184,74,397" />
</ControlTemplate>
</Thumb.Template>
</Thumb>
<Thumb Canvas.Left="21" DragDelta="Thumb_DragDelta" Canvas.Top="-18">
<Thumb.Template>
<ControlTemplate>
<Image Name="Image3" Source="/Images/Image3.png" Height="124" Width="260" Margin="82,426,697,151" />
</ControlTemplate>
</Thumb.Template>
</Thumb>
<Thumb Canvas.Left="30" Canvas.Top="1" DragDelta="Thumb_DragDelta">
<Thumb.Template>
<ControlTemplate>
<Image Name="Image4" Source="/Images/Image4.png" Height="124" Width="255" Margin="744,341,39,236" />
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Canvas>
I have then included the following in the code behind, so that these thumb images can be moved around on screen, which works fine.
// Move images on canvas
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
UIElement thumb = e.Source as UIElement;
Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + e.HorizontalChange);
Canvas.SetTop(thumb, Canvas.GetTop(thumb) + e.VerticalChange);
}
Does anyone know a quick add where I can add to this code with the thumbs on the canvas so that I have the option to rotate these images on a button click in different directions and different angles?
Thanks