FrameworkElement.OnInitialized(EventArgs) FrameworkElement.OnInitialized(EventArgs) FrameworkElement.OnInitialized(EventArgs) FrameworkElement.OnInitialized(EventArgs) Method

定義

引發 Initialized 事件。Raises the Initialized event. 每當 IsInitialized 在內部設為 true 便會叫用此方法。This method is invoked whenever IsInitialized is set to true internally.

protected:
 virtual void OnInitialized(EventArgs ^ e);
protected virtual void OnInitialized (EventArgs e);
abstract member OnInitialized : EventArgs -> unit
override this.OnInitialized : EventArgs -> unit
Protected Overridable Sub OnInitialized (e As EventArgs)

參數

e
EventArgs EventArgs EventArgs EventArgs

包含事件資料的 RoutedEventArgsThe RoutedEventArgs that contains the event data.

備註

此特定 On * 方法並不是類別處理常式的勾點。This particular On* method is not a class handler hook. 也不是完全遵循在 * 通用語言執行平台 (CLR)common language runtime (CLR)方法慣例上建立的, 而是藉由覆寫這個方法, 而不是呼叫基底執行來隱藏比對事件。Nor does it exactly follow the established 通用語言執行平台 (CLR)common language runtime (CLR) On* method convention that the matching event could be suppressed by overriding this method and not calling the base implementation.

請注意IsInitialized ,屬性是唯讀的,因此您無法將設定為強制IsInitialized執行初始化行為。Note that the IsInitialized property is read-only, so you cannot set IsInitialized to force initialization behavior. 設定初始化狀態的目的只是要由Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)架構來完成。Setting the initialization state is intended to be done only by the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) framework.

給繼承者的注意事項

此虛擬方法的預設實作會引發事件,如先前所述。The default implementation of this virtual method raises the event as described above. 覆寫應呼叫基底實作以保留此行為。Overrides should call the base implementation to preserve this behavior. 如果您無法呼叫基底實作為, 不僅不會引發Initialized事件, 通常是FrameworkElement衍生類別的預期, 但您也會隱藏兩個重要樣式和主題樣式的初始化作業,由這個基底實作為執行。If you fail to call the base implementation, not only will you not raise the Initialized event as is generally expected of a FrameworkElement derived class, but you will also suppress two important style and theme style initialization operations that are implemented by this base implementation.

適用於

另請參閱