Exemple #1
0
        //当探测命令是否可执行的时候该方法会被调用
        private void cb_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            string UIName = e.ToString();

            if (string.IsNullOrEmpty(txt1.Text))
            {
                e.CanExecute = false;
            }
            else
            {
                //验证指令来自哪方将军,我方就执行
                if (e.Parameter.ToString() == "btn1")
                {
                    e.CanExecute = true;
                }
            }
            //降低事件继续向上传递而降低程序性能
            e.Handled = true;
        }