FrameworkElement.OnRenderSizeChanged(SizeChangedInfo) FrameworkElement.OnRenderSizeChanged(SizeChangedInfo) FrameworkElement.OnRenderSizeChanged(SizeChangedInfo) FrameworkElement.OnRenderSizeChanged(SizeChangedInfo) Method


使用指定的資訊作為最終事件資料的一部分,引發 SizeChanged 事件。Raises the SizeChanged event, using the specified information as part of the eventual event data.

protected public:
 override void OnRenderSizeChanged(System::Windows::SizeChangedInfo ^ sizeInfo);
protected internal override void OnRenderSizeChanged (System.Windows.SizeChangedInfo sizeInfo);
override this.OnRenderSizeChanged : System.Windows.SizeChangedInfo -> unit
Protected Friend Overrides Sub OnRenderSizeChanged (sizeInfo As SizeChangedInfo)


SizeChangedInfo SizeChangedInfo SizeChangedInfo SizeChangedInfo

變更所涉及之舊和新大小的詳細資料。Details of the old and new size involved in the change.


這個方法覆寫 OnRenderSizeChangedThis method overrides OnRenderSizeChanged. 如果您呼叫這個方法, 則會根據ActualWidth所提供自ActualHeight變數中指定的變更, 重設屬性、屬性或兩者, 而且您一律會引發事件。If you call this method you will reset the ActualWidth property, the ActualHeight property, or both, depending on what is specified as changed in the supplied arguments, and will you always raise the event.


請勿針對一般版面配置案例覆寫此方法。Do not override this method for typical layout scenarios. 版面配置系統會以刻意非同步方式操作, 以確保所有可能的版面配置排列和量值案例都已納入考慮。The layout system operates in a deliberately asynchronous way to assure that all possible layout arrange and measure cases are accounted for. 版面配置系統會覆MeasureOverride(Size)ArrangeOverride(Size)方法, 而且通常足以應付任何必要的版面配置自訂。The layout system override methods MeasureOverride(Size) and ArrangeOverride(Size) are usually sufficient for any required layout customization. OnRenderSizeChanged(SizeChangedInfo)會公開為虛擬。OnRenderSizeChanged(SizeChangedInfo) is exposed as a virtual. 您可以覆OnRenderSizeChanged(SizeChangedInfo)寫以更正例外狀況, 其中與在回應中的控制項重新組合結合的輸入事件相關聯的執行時間行為變更可能會提供不正確的版面配置資訊。You can override OnRenderSizeChanged(SizeChangedInfo) to correct for exceptional cases where a run-time behavioral change related to input events combined with control recomposition in response might give inaccurate layout information.

您仍然可以在衍生類別中覆寫這個方法 (它是受保護的, 但不是密封的)。You may still override this method in derived classes (it is protected but not sealed). 除非您有非常明確的原因要停用預設的 WPF 架構層級轉譯行為, 否則請一律呼叫基底執行來保留上述行為。Always call the base implementation to preserve the behavior mentioned above, unless you have very specific reasons for disabling default WPF framework-level rendering behavior. 如果使用標準的SizeChanged WPF 架構層級版面配置系統, 則無法引發事件會導致非標準的版面配置行為。Failing to raise the SizeChanged event will cause non-standard layout behavior if using the standard WPF framework-level layout system implementation.