WPF之Command基础
1、界面布局,文本框和按钮

2、声明并定义命令private RoutedCommand sayCmd = new RoutedCommand("Say", typeof(MainWindow));

8、命令可执行逻辑e.CanExecute = myText.Text.ToString() == "" ? false : true;

10、执行效果如下

1、界面布局,文本框和按钮
2、声明并定义命令private RoutedCommand sayCmd = new RoutedCommand("Say", typeof(MainWindow));
8、命令可执行逻辑e.CanExecute = myText.Text.ToString() == "" ? false : true;
10、执行效果如下