FrameworkElement.OnInitialized(EventArgs) 方法

定义

引发 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

包含事件数据的 RoutedEventArgsThe RoutedEventArgs that contains the event data.

注解

此特定于 * 方法不是类处理程序挂钩。This particular On* method is not a class handler hook. 它也不会完全遵循建立的 公共语言运行时 (CLR)common language runtime (CLR) On * 方法约定,可以通过重写此方法而不调用基实现来取消匹配的事件。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. 如果无法调用基实现,则不会像通常是 FrameworkElement 派生类那样引发 Initialized 事件,但也会禁止执行此操作所实现的两个重要的样式和主题样式初始化操作。基本实现。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.

适用于

另请参阅