One ScaleTransform to a group of layers
Here's what I want to do - given a couple of [image] layers inside a scrollviewer, I'd like to apply the same scaling factor to all layers.
In Xaml, I have a scroll viewer that hosts a grid that hosts two image controls. I have a checkbox that controls the visibility of the top image. Right now, I have a scaletransform for each image, and apply the same scale for both.
开发者_运维技巧Is there a way to unify scaling in just one container?
Sure you can just apply the scale transform at a higher level, e.g. you could apply it to the grid.
<Grid.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="1.0" ScaleY="1.0"/>
</TransformGroup>
</Grid.LayoutTransform>
That will automatically propagate the transform down to any child that ends up inside that grid.
Regards, Donovan
精彩评论