CanExecuteRoutedEventHandler 代理人

定義

CanExecute イベントを処理するメソッドを表します。

public delegate void CanExecuteRoutedEventHandler(System::Object ^ sender, CanExecuteRoutedEventArgs ^ e);
public delegate void CanExecuteRoutedEventHandler(object sender, CanExecuteRoutedEventArgs e);
type CanExecuteRoutedEventHandler = delegate of obj * CanExecuteRoutedEventArgs -> unit
Public Delegate Sub CanExecuteRoutedEventHandler(sender As Object, e As CanExecuteRoutedEventArgs)

パラメーター

sender
Object

ハンドラーを起動しているコマンドの対象。

e
CanExecuteRoutedEventArgs

イベントのデータ。

次の例は、 を CanExecuteRoutedEventHandler に設定 CanExecute する を true示しています。

void OpenCmdCanExecute(object sender, CanExecuteRoutedEventArgs e)
{
    e.CanExecute = true;
}
Private Sub OpenCmdCanExecute(ByVal sender As Object, ByVal e As CanExecuteRoutedEventArgs)
    e.CanExecute = True
End Sub

注釈

CanExecuteRoutedEventHandler 、イベント ソースに関連付けられているコマンドをコマンド ターゲットで実行できるかどうかを決定します。 コマンドにターゲットを指定するコマンド ソースがある場合は、 を使用してターゲット情報を sender取得できます。 CommandTargetが設定されていない場合、キーボード フォーカスを持つ要素がターゲットになり、 を使用してsender取得することもできます。 コマンドがターゲットで実行できると判断された場合は、 プロパティを CanExecuteRoutedEventArgs.CanExecute に設定する true必要があります。それ以外の場合は、 に設定します false

コマンド、ソース、ターゲットを決定するためにイベント データに依存する必要はありません。 ハンドラーの使用を既知の可能なコマンド呼び出しに制限できますが、コマンド構造がコマンド ルーティングに広範囲に依存して、イベント ルート内の連続する潜在的なターゲットに対して同じコマンドを実行する場合は、これを実現することはより困難です。

拡張メソッド

GetMethodInfo(Delegate)

指定したデリゲートによって表されるメソッドを表すオブジェクトを取得します。

適用対象

こちらもご覧ください