FrameworkElement.EndInit FrameworkElement.EndInit FrameworkElement.EndInit FrameworkElement.EndInit Method


表示項目的初始設定程序已完成。Indicates that the initialization process for the element is complete.

 virtual void EndInit();
public virtual void EndInit ();
abstract member EndInit : unit -> unit
override this.EndInit : unit -> unit
Public Overridable Sub EndInit ()



呼叫 EndInit() 時,沒有在項目上先呼叫 BeginInit()EndInit() was called without BeginInit() having previously been called on the element.


如果BeginInit先前已呼叫, 基底實作為會Initialized引發事件。If BeginInit was previously called, the base implementation will raise the Initialized event. 否則, 如果BeginInit未呼叫或無法判斷是否BeginInit已呼叫, 則不會引發Initialized , 而是會擲回例外狀況。Otherwise, if BeginInit was not called or it could not be determined whether BeginInit was called, Initialized is not raised and an exception is thrown instead.


執行這個方法, 以提供在專案載入進程期間初始化專案時, 應該會發生的特殊處理。Implement this method to provide special handling that should happen when your element is initialized during the element loading process.

您的執行應該會呼叫基底實作為, 因為基底 (預設值) 會設定一些內部旗標來追蹤初始化。Your implementation should call the base implementation, because the base (default) implementation sets some internal flags to keep track of initialization.