I am using Canvas inside ItemsControl where shapes such as rectangle, circle can be drawn. I want to resize and move the drawn shapes. I tried using adorners, but didnt find a way to use adorners inside ItemsControl, is this possible?
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<zc:ZoomableCanvas Loaded="Canvas_Loaded"
RealizationLimit="1000"
RealizationRate="10"
RealizationPriority="Background"
ApplyTransform="False"
Scale="{Binding ZoomableCanvas.Scale}"
Offset="{Binding ZoomableCanvas.Offset}" ClipToBounds="True"
Width="{Binding ZoomableCanvas.ActualWidth}"
Height="{Binding ZoomableCanvas.ActualHeight}"
>
</zc:ZoomableCanvas>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
It might be that the answer comes a bit late, but nevertheless I write it for future reference.
The Canvas
you are using can only show adorners if it lives within an AdornerDecorator
. Try this:
<AdornerDecorator>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<zc:ZoomableCanvas Loaded="Canvas_Loaded"
RealizationLimit="1000"
RealizationRate="10"
RealizationPriority="Background"
ApplyTransform="False"
Scale="{Binding ZoomableCanvas.Scale}"
Offset="{Binding ZoomableCanvas.Offset}"
ClipToBounds="True"
Width="{Binding ZoomableCanvas.ActualWidth}"
Height="{Binding ZoomableCanvas.ActualHeight}"
>
</zc:ZoomableCanvas>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</AdornerDecorator>
I hope this helps!