0
두 개의 단추가있는 3.5 WPF 사용자 정의 컨트롤이 있고 사용자 정의 컨트롤의 xaml을 통해이 단추에 명령을 바인딩 할 수 있기를 바랍니다.WPF 사용자 컨트롤 XAML 명령
x:Usercontrol x:Name:fou Button1Command="{Binding StuffCommandHandler}" Button2Command="{Binding Stuff2CommandHandler}"
위의 바인딩이 작동하지 않는 문제가 있습니다. xaml을 통해 사용자 정의 컨트롤의 단추 중 두 개에 명령을 바인딩하는 방법은 무엇입니까?
나는 뒤에있는 UserControl의 코드에서이있어 그리고 당신은 종속성 속성에 Button1CommandHandler
을해야
private ICommand _button1Command;
public ICommand Button1CommandHandler
{
get { return _button1Command; }
set { _button1Command = value; }
}
, Button1.Command = ButtonCommand하지만 컨트롤이 이해할 수있는 생성 될 때 ButtonCommand은 null입니다. 그러나 xaml 바인딩이 발생하면 Buttoncommand 세트가 시작되지 않으므로 hte 버튼을 클릭하면 StuffCommandHandler가 실행되지 않습니다. 내가 뭘 놓치고 있니? – mike
ButtonCommand 세트의 중단 점을 넣었습니다. 결코 실행되지 않습니다. – mike
* Button1.Command를 * ButtonCommand에 바인드해야합니다. – svick