一个 ScaleTransform 到一组图层

发布于 2024-10-05 07:49:07 字数 180 浏览 7 评论 0原文

这就是我想要做的 - 给定滚动查看器内的几个[图像]层,我想对所有层应用相同的缩放因子。

在 Xaml 中,我有一个滚动查看器,它托管一个网格,该网格托管两个图像控件。我有一个复选框可以控制顶部图像的可见性。现在,我对每个图像都有一个比例变换,并对两个图像应用相同的比例。

有没有一种方法可以在一个容器中统一缩放?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

山人契 2024-10-12 07:49:07

当然,您可以在更高级别应用比例变换,例如您可以将其应用到网格。

    <Grid.LayoutTransform>
      <TransformGroup>
        <ScaleTransform ScaleX="1.0" ScaleY="1.0"/>
      </TransformGroup>
    </Grid.LayoutTransform>

这将自动将变换传播到最终位于该网格内的任何子级。

问候,
多诺万

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文