CanExecuteRoutedEventArgs 클래스

정의

CanExecutePreviewCanExecute 라우트된 이벤트에 대한 데이터를 제공합니다.

public ref class CanExecuteRoutedEventArgs sealed : System::Windows::RoutedEventArgs
public sealed class CanExecuteRoutedEventArgs : System.Windows.RoutedEventArgs
type CanExecuteRoutedEventArgs = class
    inherit RoutedEventArgs
Public NotInheritable Class CanExecuteRoutedEventArgs
Inherits RoutedEventArgs
상속
CanExecuteRoutedEventArgs

예제

다음 예제에서는 명령 대상이 컨트롤인 경우에만 를 반환 true 하는 를 만듭니다CanExecuteRoutedEventHandler. 먼저 는 Source 로 캐스팅됩니다 Control. 가 인 ControlCanExecute 경우 Source 는 로 true설정되고, 그렇지 않으면 로 설정false됩니다.

// CanExecuteRoutedEventHandler that only returns true if
// the source is a control.
private void CanExecuteCustomCommand(object sender, 
    CanExecuteRoutedEventArgs e)
{
    Control target = e.Source as Control;
    
    if(target != null)
    {
        e.CanExecute = true;
    }
    else
    {
        e.CanExecute = false;
    }
}
' CanExecuteRoutedEventHandler that only returns true if
' the source is a control.
Private Sub CanExecuteCustomCommand(ByVal sender As Object, ByVal e As CanExecuteRoutedEventArgs)
    Dim target As Control = TryCast(e.Source, Control)

    If target IsNot Nothing Then
        e.CanExecute = True
    Else
        e.CanExecute = False
    End If
End Sub

설명

일반적으로 와 같은 MenuItem명령 소스는 에서 메서드를 RoutedCommand 호출 CanExecute 하여 명령이 현재 명령 대상에서 실행할 수 있는지 또는 실행할 수 없는지 확인합니다. 가 이벤트 처리기에서 로 false 설정된 경우 CanExecute 명령 원본은 자체를 사용하지 않도록 설정합니다. 예를 들어 가 MenuItem 명령의 명령 원본 역할을 하고 현재 명령 대상에서 명령을 실행할 수 없는 경우 는 MenuItem 회색으로 표시됩니다.

이벤트는 CanExecuteChanged 명령의 실행 기능이 변경되었을 수 있는 경우 명령 소스에 알 수 있습니다.

속성

CanExecute

이 이벤트와 연결된 RoutedCommand를 명령 대상에서 실행할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

Command

이 이벤트와 연결된 명령을 가져옵니다.

ContinueRouting

명령을 호출한 입력 라우트된 이벤트가 요소 트리를 통해 계속 라우트해야 할지 여부를 결정합니다.

Handled

경로를 따라 이동할 때 라우트된 이벤트의 현재 이벤트 처리 상태를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 RoutedEventArgs)
OriginalSource

부모 클래스에 의한 Source 조정 앞에 순수 적중 횟수 테스트에서 결정한 원본 보고 소스를 가져옵니다.

(다음에서 상속됨 RoutedEventArgs)
Parameter

명령별 데이터를 가져옵니다.

RoutedEvent

RoutedEventArgs 인스턴스와 연결된 RoutedEvent를 가져오거나 설정합니다.

(다음에서 상속됨 RoutedEventArgs)
Source

이벤트를 발생시킨 개체에 대한 참조를 가져오거나 설정합니다.

(다음에서 상속됨 RoutedEventArgs)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
InvokeEventHandler(Delegate, Object)

파생 클래스에서 재정의된 경우 기본 구현 이상으로 효율성을 높일 수 있는 형식별 방법으로 이벤트 처리기를 호출하는 방법을 제공합니다.

(다음에서 상속됨 RoutedEventArgs)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
OnSetSource(Object)

파생된 클래스에서 재정의되는 경우 인스턴스의 Source 속성 값이 변경될 때마다 알림 콜백 진입점을 제공합니다.

(다음에서 상속됨 RoutedEventArgs)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보