GeneralTransform:“值未落在预期范围内”

发布于 2025-01-03 19:52:07 字数 277 浏览 6 评论 0原文

我们尝试使用这样的 GeneralTransform:

 GeneralTransform gt = this.scrollViewer.TransformToVisual(Application.Current.RootVisual as UIElement);

我们经常(但并非总是)收到“值未落在预期范围内”异常。
为什么会发生这种情况?是否有某种方法可以测试元素以了解 TransformToVisual() 调用是否有效?
感谢您的任何见解...

We are trying to use a GeneralTransform like this:

 GeneralTransform gt = this.scrollViewer.TransformToVisual(Application.Current.RootVisual as UIElement);

We often, but not always, get the "Value does not fall withing expected range" exception.
Why does this happen, and is there some way to test the elements to know if the TransformToVisual() call will work?
Thanks for any insight...

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

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

发布评论

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

评论(1

但可醉心 2025-01-10 19:52:07

您只能对屏幕上可见且已布局的元素调用 TransformToVisual。

You can only call TransformToVisual on an element that is visible on the screen and already layed out.

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