UICommand UICommand UICommand UICommand Class

Definition

Represents a command in a context menu.

public sealed class UICommandpublic sealed class UICommandPublic NotInheritable Class UICommandpublic sealed class UICommand
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Use the Commands property to add or modify the commands in a context menu.

Constructors

UICommand() UICommand() UICommand() UICommand()

Creates a new instance of the UICommand class.

public UICommand()public New()Public Sub New()public UICommand()
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

UICommand(String) UICommand(String) UICommand(String) UICommand(String)

Creates a new instance of the UICommand class using the specified label.

public UICommand(String label)public New(String label)Public Sub New(label As String)public UICommand(String label)
Parameters
label
System.String System.String System.String System.String

The label for the UICommand.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

UICommand(String, UICommandInvokedHandler) UICommand(String, UICommandInvokedHandler) UICommand(String, UICommandInvokedHandler) UICommand(String, UICommandInvokedHandler)

Creates a new instance of the UICommand class using the specified label and event handler.

public UICommand(String label, UICommandInvokedHandler action)public New(String label, UICommandInvokedHandler action)Public Sub New(label As String, action As UICommandInvokedHandler)public UICommand(String label, UICommandInvokedHandler action)
Parameters
label
System.String System.String System.String System.String

The label for the new command.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

UICommand(String, UICommandInvokedHandler, Object) UICommand(String, UICommandInvokedHandler, Object) UICommand(String, UICommandInvokedHandler, Object) UICommand(String, UICommandInvokedHandler, Object)

Creates a new instance of the UICommand class using the specified label, event handler, and command identifier.

public UICommand(String label, UICommandInvokedHandler action, Object commandId)public New(String label, UICommandInvokedHandler action, Object commandId)Public Sub New(label As String, action As UICommandInvokedHandler, commandId As Object)public UICommand(String label, UICommandInvokedHandler action, Object commandId)
Parameters
label
System.String System.String System.String System.String

The label for the new command.

commandId
System.Object System.Object System.Object System.Object

The command identifier for the new command.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

Id Id Id Id

Gets or sets the identifier of the command.

public object Id { get; set; }public object Id { get; set; }Public ReadWrite Property Id As objectpublic object Id { get; set; }
Value
object object object object

Represents the identifier of the command.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

If you assign a unique identifier to each menu command, you can implement a single UICommandInvokedHandler method that handles events from multiple commands.

Invoked Invoked Invoked Invoked

Gets or sets the handler for the event that is fired when the user selects the UICommand.

public UICommandInvokedHandler Invoked { get; set; }public UICommandInvokedHandler Invoked { get; set; }Public ReadWrite Property Invoked As UICommandInvokedHandlerpublic UICommandInvokedHandler Invoked { get; set; }
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This property may be null.

Label Label Label Label

Gets or sets the label for the command.

public string Label { get; set; }public string Label { get; set; }Public ReadWrite Property Label As stringpublic string Label { get; set; }
Value
string string string string

The label for the command.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)