UICommand UICommand UICommand UICommand Class

Represents a command in a context menu.

Syntax

Declaration

public sealed class UICommandpublic sealed class UICommandPublic NotInheritable Class UICommand

Remarks

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

Constructors summary

Creates a new instance of the UICommand class.

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

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

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

Properties summary

Gets or sets the identifier of the command.

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

Gets or sets the label for the command.

Constructors

  • UICommand()
    UICommand()
    UICommand()
    UICommand()

    Creates a new instance of the UICommand class.

    public UICommand()public UICommand()Public Function UICommand() As
  • UICommand(System.String)
    UICommand(System.String)
    UICommand(System.String)
    UICommand(System.String)

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

    public UICommand(System.String)public UICommand(System.String)Public Function UICommand(System.String) As

    Parameters

    • label
      System.String
      System.String
      System.String
      System.String

      The label for the UICommand.

  • UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler)
    UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler)
    UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler)
    UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler)

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

    public UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler)public UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler)Public Function UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler) As

    Parameters

  • UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler,System.Object)
    UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler,System.Object)
    UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler,System.Object)
    UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler,System.Object)

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

    public UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler,System.Object)public UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler,System.Object)Public Function UICommand(System.String,Windows.UI.Popups.UICommandInvokedHandler,System.Object) As

    Parameters

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 object

    Property Value

    • object
      object
      object
      object

      Represents the identifier of the command.

    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 UICommandInvokedHandler

    Property Value

    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 string

    Property Value

    • string
      string
      string
      string

      The label for the command.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.MuseAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.UI.Popups.dll