Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 2.23 KB

xamluicommand.md

File metadata and controls

46 lines (29 loc) · 2.23 KB
-api-id -api-type ms.custom
T:Windows.UI.Xaml.Input.XamlUICommand
winrt class
RS5

Windows.UI.Xaml.Input.XamlUICommand

-description

Provides a base class for defining the command behavior of an interactive UI element that performs an action when invoked (such as sending an email, deleting an item, or submitting a form).

-remarks

Implements the ICommand interface (Windows.UI.Xaml.Input.ICommand for C++ or System.Windows.Input.ICommand for C#), adding various UI properties, methods, and events.

XamlUICommand derived classes

XamlUICommand is the parent class for StandardUICommand, which exposes a set of standard platform commands with pre-defined properties.

For a basic commanding example see the Button control, which is designed to make something happen when a user clicks it.

There are two ways to process a Button command (controls with a Command property support similar functionality):

  • Handle the Click event
  • Bind the Command property to an ICommand implementation that describes the command logic

XamlUICommand lets you specify UI through the control binding, such as an icon, label, description, and keyboard shortcuts (both an access key and a keyboard accelerator), without setting the individual properties.

-see-also

StandardUICommand, Commanding in Universal Windows Platform apps using StandardUICommand, XamlUICommand, and ICommand

-examples

Tip

For more info, design guidance, and code examples, see Command design basics.

If you have the WinUI 2 Gallery app installed, click here to open the app and see the StandardUICommand in action.