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 架構層級專案會使用的覆寫實作為 FrameworkElementA 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. OnRenderSizeChangedUIElement 層級覆寫表示您的專案實刻意不使用 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.