Redigera

Dela via


ListView.OnBubbleEvent(Object, EventArgs) Method

Definition

Determines whether an event for the ListView control should be handled.

protected:
 override bool OnBubbleEvent(System::Object ^ source, EventArgs ^ e);
protected override bool OnBubbleEvent (object source, EventArgs e);
override this.OnBubbleEvent : obj * EventArgs -> bool
Protected Overrides Function OnBubbleEvent (source As Object, e As EventArgs) As Boolean

Parameters

source
Object

The source of the event.

e
EventArgs

The event data.

Returns

true if the event should be handled; otherwise, false.

Remarks

The OnBubbleEvent method is used by the ListView control to optionally handle events that are passed up through the control hierarchy. It determines whether to handle an event by examining the properties of the EventArgs object that are contained in the e parameter. When an event must be handled, the method performs the appropriate action. Other events are ignored and passed up the control hierarchy. The return value of this method indicates whether to handle the event or to pass the event up the control hierarchy.

The ListView control overrides the base implementation of this method to perform the appropriate action when one of the buttons that is recognized by the control is clicked. The following table lists the buttons that the ListView control recognizes.

CommandName value Description
"Cancel" Cancels an edit or insert operation. Raises the ItemCanceling event.
"Delete" Deletes the current record from the data source. Raises the ItemDeleted and ItemDeleting events.
"Select" Sets the SelectedIndex property to the DisplayIndex property value for the item. Renders the SelectedItemTemplate template for the item. Raises the SelectedIndexChanging and SelectedIndexChanged events.
"Edit" Puts the item in edit mode. Renders the EditItemTemplate template for the item. Raises the ItemEditing event.
"Insert" Inserts the bound values from the InsertItemTemplate template into the data source. Raises the ItemInserting and ItemInserted events.
"Update" Updates the current record in the data source with the bound values from the EditItemTemplate template. Raises the ItemUpdating and ItemUpdated events.
"Sort" Sorts the columns listed in the CommandArgument property of the button. Raises the Sorting and Sorted events.

This version of the method returns true if one of these buttons raises an event that is handled by the control. For more information about event bubbling, see Handling and Raising Events.

Applies to

See also