Reputation: 271
Is there any way to rotate only the canvas without rotating it's children like image, geometry etc in it? Any help anyone could produce would highly be appreciated.
Many thanks Ratheesh
Upvotes: 2
Views: 2630
Reputation: 178670
No, there's no way of doing this unless you apply the opposite transformation to each child. Perhaps if you explain what you're trying to achieve, there is likely an easier way to do so.
Upvotes: 0
Reputation: 2417
I think only way is to rotate Canvas
and rotate it's children in another direction.
Upvotes: 2
Reputation: 184534
Kent Boogarts suggestion is what i thought of initially too, it's not even that hard to implement since one can directly bind to the Inverse
transform of the Canvas:
<ItemsControl>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas>
<Canvas.RenderTransform>
<RotateTransform />
</Canvas.RenderTransform>
</Canvas>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Content="{Binding}"
RenderTransform="{Binding RelativeSource={RelativeSource AncestorType=Canvas},
Path=RenderTransform.Inverse}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Upvotes: 3