public interface class ICommand
public interface ICommand
[System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
public interface ICommand
[System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
public interface ICommand
type ICommand = interface
[<System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")>]
type ICommand = interface
[<System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")>]
type ICommand = interface
Public Interface ICommand
Microsoft.Windows.Input.IPreviewCommand RoutedCommand RoutedUICommand 是 #DEDFF8D4A0FD84593BA2DA13288ED3905 (WPF) 中介面的 ICommand 兩個實作。

Windows 執行階段 應用程式中的 ICommand

介面 ICommand 是在 .NET 中針對 Windows 執行階段 應用程式撰寫之命令的程式代碼合約。 這些命令提供 UI 元素的命令行為,例如 Windows 執行階段 XAML Button ,特別是 AppBarButton 。 如果您要定義 Windows 執行階段 應用程式的命令,您基本上會使用相同的技術來定義 .NET 應用程式的命令。 定義實作 並特別實作 方法的 Execute 類別, ICommand 以實作 命令。

Windows 執行階段 的 XAML 不支援 x:Static ,因此,如果命令是從 Windows 執行階段 XAML 使用,請勿嘗試使用 x:Static 標記延伸。 此外,Windows 執行階段 沒有任何預先定義的命令連結庫,因此此處所示的 XAML 語法並不適用於您實作 介面並定義命令以使用 Windows 執行階段 用法的情況。

XAML 屬性用法

<object-property="predefined-command-name"/>
<object-property="predefined-class-name.predefined-command-name"/>
<object-property="{custom-class-name.custom-command-name}"/>

XAML 值

predefined-class-name
其中一個預先定義的命令類別。

predefined-command-name
其中一個預先定義的命令。

custom-class-name
包含自訂命令的自定義類別。 自定義類別通常需要前置 xlmns 詞對應。 如需詳細資訊,請參閱 WPF XAML 的 XAML 命名空間和命名空間對應

custom-command-name
自訂命令。