Command Extensions
Provides Command/CommandParameter attached properties for common scenarios.
Attached Properties
| Property | Type | Description | 
|---|---|---|
Command | 
ICommand | 
Sets the command to execute when interacting with the control.* | 
CommandParameter | 
object | 
Sets the parameter to pass to the Command property. | 
Remarks
Commandis executed on:ListViewBase.ItemClickSelector.SelectionChanged(except forListViewwhich usesItemClick)NavigationView.ItemInvokedItemsRepeateritem tappedTextBoxandPasswordBoxwhen the Enter key is pressedToggleSwitchtoggled- any 
UIElementtapped 
- For 
Command, the relevant parameter is also provided for theCanExecuteandExecutecall:CommandParametercan be set, on the item-container or item-template's root for collection-type control, or control itself for other controls, to replace the following.ItemClickEventArgs.ClickedItemfromListView.ItemClickSelector.SelectedItemNavigationViewItemInvokedEventArgs.InvokedItemfromNavigationView.ItemInvokedItemsRepeater's item root's DataContextTextBox.TextToggleSwitch.IsOnPasswordBox.PasswordUIElementitself
 CommandonTextBox/PasswordBox*: Having this set will also cause the keyboard to dismiss on enter.CommandonListView*:IsItemClickEnabledmust also be set to true for this to work.
Usage
For more details on using the Command Extensions in your project, check out our Tech Bite video:
<!-- Include the following XAML namespace to use the samples below -->
xmlns:utu="using:Uno.Toolkit.UI"
...
<!-- Execute command on enter -->
<PasswordBox utu:CommandExtensions.Command="{Binding Login}" />
<!-- Execute command on toggle -->
<ToggleSwitch utu:CommandExtensions.Command="{Binding SetDarkMode}" />
<!-- ListView item click-->
<ListView ItemsSource="123"
          IsItemClickEnabled="True"
          utu:CommandExtensions.Command="{Binding UpdateSelection}" />
<!-- NavigationView item invoke -->
<NavigationView utu:CommandExtensions.Command="{Binding Navigate}">
    <NavigationView.MenuItems>
        <NavigationViewItem Content="Apple" />
        <NavigationViewItem Content="Banana" />
        <NavigationViewItem Content="Cactus" />
    </NavigationView.MenuItems>
</NavigationView>
<muxc:ItemsRepeater ItemsSource="123" utu:CommandExtensions.Command="{Binding UpdateSelection}" />