Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

command | oncommand event

Fired whenever a user interface (UI) action takes place.

Syntax

HTML Attribute <element oncommand = "handler(event)">
addEventListener Method object.addEventListener("command", handler, useCapture)

 

Event information

SynchronousYes
BubblesYes
CancelableYes

 

Event handler parameters

event

Type: CommandEvent

Remarks

This event provides a hook into the UI action currently taking place, allowing you to update the page state and UI and / or prevent default event behavior.

The command is fired for all of the following Windows UI Automation (UIA) methods:

commandName UIA Method
toggle IToggleProvider::Toggle
expand IExpandCollapseProvider::Expand
collapse IExpandCollapseProvider::Collapse
scrollIntoView IScrollItemProvider::ScrollIntoView
select ISelectionItemProvider::Select
addToSelection ISelectionItemProvider::AddToSelection
removeFromSelection ISelectionItemProvider::RemoveFromSelection
setValue IValueProvider::SetValue
scrollHorizontal IScrollProvider::Scroll
scrollVertical IScrollProvider::Scroll
setHorizontalScrollPercent IScrollProvider::SetScrollPercent

 

Examples


function handleCommand(evt) {
    var myContainer = document.getElementById("content");
    if (evt.target == myContainer && evt.commandName == "toggle") {
        evt.preventDefault();
    }
}

See also

Element
ariarequest

 

 

Show:
© 2017 Microsoft