I have managed to do something similar:
- Set image as background
- Put a transparent
ItemsControl
on top of it
- Set
ItemsControl.ItemsPanel
to Canvas
- wrote handlers for dragging operations
Code Snippet:
<ItemsControl x:Name="overlayItemsControl"
Background="Transparent"
ItemsSource="{Binding Path=Blocks}"
Width="{Binding ElementName=imageControl, Path=Width}"
Height="{Binding ElementName=imageControl, Path=Height}"
ItemContainerStyle="{StaticResource rectStyle}"
PreviewMouseMove="ItemsControl_PreviewMouseMove"
PreviewMouseDown="ItemsControl_PreviewMouseDown"
PreviewMouseUp="ItemsControl_PreviewMouseUp"
PreviewKeyDown="ItemsControl_PreviewKeyDown">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas IsItemsHost="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
....
</ItemsControl>