Command 클래스

정의

Action을 래핑하는 ICommand 구현을 정의합니다.

public class Command : System.Windows.Input.ICommand
type Command = class
    interface ICommand
상속
Command
파생
구현

설명

다음 예제에서는 새 명령을 만들고 단추로 설정합니다.

var command = new Command (() => Debug.WriteLine ("Command executed"));
var button = new Button {
  Text = "Hit me to execute the command",
  Command = command,
};

더 유용한 시나리오는 매개 변수를 사용합니다.

var command = new Command (o => Debug.WriteLine ("Command executed: {0}", o));
var button = new Button {
  Text = "Hit me to execute the command",
  Command = command,
  CommandParameter = "button0",
};

생성자

Command(Action)

명령 클래스의 새 인스턴스를 초기화합니다.

Command(Action, Func<Boolean>)

명령 클래스의 새 인스턴스를 초기화합니다.

Command(Action<Object>)

명령 클래스의 새 인스턴스를 초기화합니다.

Command(Action<Object>, Func<Object,Boolean>)

명령 클래스의 새 인스턴스를 초기화합니다.

메서드

CanExecute(Object)

지정된 매개 변수로 명령을 실행할 수 있는지 여부를 나타내는 Boolean을 반환합니다.

ChangeCanExecute()

CanExecuteChanged 보내기

Execute(Object)

작업 실행 호출

이벤트

CanExecuteChanged

명령의 대상이 명령을 실행할 수 있는지 여부를 다시 평가해야 할 때 발생합니다.

적용 대상