ListView.OnLayoutCreated(EventArgs) 方法

定义

引发 LayoutCreated 事件。Raises the LayoutCreated event.

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

参数

e
EventArgs

事件数据。The event data.

注解

ListView 呈现控件之前, ListViewItem 必须创建对象以充当控件的容器。Before the ListView control can be rendered, a ListViewItem object must be created to act as the container for the control. LayoutCreated在控件中创建布局模板时,会引发事件 ListViewThe LayoutCreated event is raised when the layout template is created in the ListView control. 这使您可以在每次发生此事件时执行自定义例程,如更改模板内的控件的可见性 LayoutTemplateThis enables you to perform a custom routine whenever this event occurs, such as changing the visibility of a control that is inside the LayoutTemplate template.

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息,请参阅 处理和引发事件For more information, see Handling and Raising Events.

OnLayoutCreated方法还使派生类可以处理事件,而无需附加委托。The OnLayoutCreated method also enables derived classes to handle the event without attaching a delegate. 这是在派生类中处理事件的首选技术。This is the preferred technique for handling the event in a derived class.

继承者说明

当在 OnLayoutCreated(EventArgs) 派生类中重写时,调用基类的 OnLayoutCreated(EventArgs) 方法,以便注册的委托接收事件。When you override OnLayoutCreated(EventArgs) in a derived class, call the base class's OnLayoutCreated(EventArgs) method so that registered delegates receive the event.

适用于

另请参阅