UIElement.CommandBindings UIElement.CommandBindings UIElement.CommandBindings UIElement.CommandBindings Property

정의

이 요소와 연결된 CommandBinding 개체의 컬렉션을 가져옵니다.Gets a collection of CommandBinding objects associated with this element. CommandBinding을 사용하면 이 요소에 대해 명령을 처리할 수 있으며 명령, 해당 이벤트 및 이 요소에 의해 연결되는 처리기 간의 연결을 선언할 수 있습니다.A CommandBinding enables command handling for this element, and declares the linkage between a command, its events, and the handlers attached by this element.

public:
 property System::Windows::Input::CommandBindingCollection ^ CommandBindings { System::Windows::Input::CommandBindingCollection ^ get(); };
public System.Windows.Input.CommandBindingCollection CommandBindings { get; }
member this.CommandBindings : System.Windows.Input.CommandBindingCollection
Public ReadOnly Property CommandBindings As CommandBindingCollection

속성 값

예제

다음 예제에서는 추가 CommandBinding 태그를 사용 하 여 창에 있습니다.The following example adds a CommandBinding to a window using markup. XAMLXAMLCommandBindingCollection 요소로; 태그에 선언 되지 않은 컬렉션 개체 속성을 사용 하는 형식에서 유추 되 고 하나 이상의 속성 요소를 채울 CommandBinding 요소:Note that in XAMLXAML, the CommandBindingCollection is not declared in the markup as an element; the collection object is inferred by the type that the property takes, and you populate the property element with one or more CommandBinding elements:

<Window.CommandBindings>
  <CommandBinding Command="ApplicationCommands.Open"
                  Executed="OpenCmdExecuted"
                  CanExecute="OpenCmdCanExecute"/>
</Window.CommandBindings>

에 대 한 자세한 내용은 합니다 XAMLXAML 컬렉션에 대 한 구문 참조 XAML 구문 정보합니다.For more information about the XAMLXAML syntax for collections, see XAML Syntax In Detail.

다음 예제에서는 코드에서 동일한 작업을 수행합니다.The following example does essentially the same thing in code:

// Creating CommandBinding and attaching an Executed and CanExecute handler
CommandBinding OpenCmdBinding = new CommandBinding(
    ApplicationCommands.Open,
    OpenCmdExecuted,
    OpenCmdCanExecute);

this.CommandBindings.Add(OpenCmdBinding);
' Creating CommandBinding and attaching an Executed and CanExecute handler
Dim OpenCmdBinding As New CommandBinding(ApplicationCommands.Open, AddressOf OpenCmdExecuted, AddressOf OpenCmdCanExecute)

Me.CommandBindings.Add(OpenCmdBinding)

설명

또 다른 일반적인 방법은 채우기는 CommandBindings 컬렉션에 사용 될 CommandManager 메서드 프로그래밍 방식으로 합니다.Another typical way to populate the CommandBindings collection is to use CommandManager methods programmatically.

XAML 속성 요소 사용XAML Property Element Usage

<object>  
  <object.CommandBindings>  
    oneOrMoreCommandBindings  
  </object.CommandBindings>  
</object>  

XAML 값XAML Values

oneOrMoreCommandBindingsoneOrMoreCommandBindings
하나 이상의 CommandBinding 요소입니다.One or more CommandBinding elements. 이러한 각 있어야를 Command 특성에는 알려진된 명령 설정 및 특성에 대 한 설정를 CanExecuteExecuted 처리기를 구현 합니다.Each of these should have a Command attribute set to a known command, and attributes set for the CanExecute and Executed handler implementations. 자세한 내용은 CommandBinding를 참조하세요.For more information see CommandBinding.

적용 대상

추가 정보