WPF Scale Transform 和 ScrollViewer - 当 Zoomed 无法滚动超出原始大小时 [英] WPF Scale Transform and ScrollViewer - When Zoomed can't scroll beyond original size

查看:35
本文介绍了WPF Scale Transform 和 ScrollViewer - 当 Zoomed 无法滚动超出原始大小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ScrollViewer 中有一个 StackPanel.

I have a StackPanel inside of a ScrollViewer.

我有一个滑块,可以在堆栈面板上进行缩放转换,以实现放大和缩小功能.问题是,当我放大时,滚动查看器不会将内容视为更大".

I have a slider that does a scale transform on the stackpanel to allow zoom-in and zoom-out functionality. The problem is that when I zoom in, the scrollviewer doesn't treat the content as being 'bigger'.

因此,如果我稍微向内滚动并尽可能向右滚动 - 它会在我到达内容结尾之前阻止我.如果我缩小到未转换的级别,我会看到它恰好在那个点停止.如果我放大很多,当我一直滚动时,我只能看到我全部内容的一小部分.

So, if I scroll in a little and scroll as far right as I can go - it stops me before I get to the end of the content. If I zoom back out to the untransformed level, I see that it's stopping exactly at that point. If I zoom in a lot, I can only see a small fraction of my total content when I scroll all the way over.

我可以改变TransformOrigin来控制哪一边丢失的内容最多;但我认为滚动查看器(或其他控件?)应该有办法帮我处理它.

I can change the TransformOrigin to control which side loses the most content; but I figure there should be some way for the scrollviewer (or another control?) to take care of it for me.

推荐答案

你在做渲染变换,还是布局变换?你应该做后者.

Are you doing render transform, or layout transform? You should be doing the latter.

这篇关于WPF Scale Transform 和 ScrollViewer - 当 Zoomed 无法滚动超出原始大小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆