UIElement.OnRenderSizeChanged(SizeChangedInfo) 方法


在派生类中重写时,会参与由布局系统控制的呈现操作。When overridden in a derived class, participates in rendering operations that are directed by the layout system. 如果元素的 RenderSize 已因布局更新而更改,则在布局更新之后以及呈现之前调用此方法。This method is invoked after layout update, and before rendering, if the element's RenderSize has changed as a result of layout update.

protected public:
 virtual void OnRenderSizeChanged(System::Windows::SizeChangedInfo ^ info);
protected internal virtual void OnRenderSizeChanged (System.Windows.SizeChangedInfo info);
abstract member OnRenderSizeChanged : System.Windows.SizeChangedInfo -> unit
override this.OnRenderSizeChanged : System.Windows.SizeChangedInfo -> unit
Protected Friend Overridable Sub OnRenderSizeChanged (info As SizeChangedInfo)



打包的参数 (SizeChangedInfo),其中包括新旧大小,其尺寸实际上发生了改变。The packaged parameters (SizeChangedInfo), which includes old and new sizes, and which dimension actually changes.


此方法没有默认实现。This method has no default implementation. 典型的 WPF 框架级别元素使用 FrameworkElement中的重写实现。A typical WPF framework-level element uses the override implementation from FrameworkElement. FrameworkElement 实现将使 WidthHeight 属性,并处理重塑布局的基本知识。The FrameworkElement implementation invalidates the Width and Height properties and handles the basics of remaking the layout. UIElement 级别重写 OnRenderSizeChanged 意味着元素实现有意不要使用 WPF 框架级别的实现,因此,你的元素必须更直接处理布局逻辑,通常通过编写替换布局来实现主板.Overriding OnRenderSizeChanged at the UIElement level implies that your element implementation is deliberately not using the WPF framework-level implementation, and therefore your element must handle layout logic more directly, typically by writing a replacement layout system.