可以给我一个例子,当应使用UIElement.UpdateLayout()? [英] Can give me an example that when should use UIElement.UpdateLayout()?

查看:1142
本文介绍了可以给我一个例子,当应使用UIElement.UpdateLayout()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在读这个 UpdateLayout请()方法中 MSDN

I was reading about this UpdateLayout() method in MSDN.

它说:

请确保此元素的所有可视子元素得到妥善
进行了布局更新。

Ensures that all visual child elements of this element are properly updated for layout.

但我不明白什么的不更新布局正确意思

我一直在与Silverlight / WPF工作一年多了,但我还没有使用这种方法一次。

I have been working with Silverlight/WPF for over a year, but I still haven't used this method once.

所以,有人可以给我,这将需要使用这种方法的一个例子吗?因此,我可以真正了解它做什么,当我应该使用它?

So can someone give me an example that will require use of this method? So I can really understand what it does and when I should use it?

推荐答案

您可能想,如果你需要调用这个控制立即完成其布局,这样就可以以此为基础进行的东西。例如,您可以调用 UpdateLayout请对孩子的控制,使其得到一个的ActualHeight ActualWidth的,如果你想要做的做基于别的东西(例如位置,或者画点什么了相应的大小)。

You might want to call this if you need a control to immediately complete its layout so that you can do something based on that. For example, you might call UpdateLayout on a child control so that it gets an ActualHeight and ActualWidth, if you want do do something else based on that (eg position it, or draw something with a corresponding size).

这篇关于可以给我一个例子,当应使用UIElement.UpdateLayout()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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