赞
踩
自定义指令
- public class MyCommand : ICommand
- {
- public event EventHandler CanExecuteChanged;
-
- public bool CanExecute(object p)
- {
- return true;
- }
-
- public void Execute(object p)
- {
- var window = p as Window;
- if (window != null)
- {
- window.Close();
- }
- }
- }
public MainWindow()
{
InitializeComponent();
M1 = new MyCommand();
this.DataContext = this;
//把指令封装公共类里面
//M1 = new CMD();
//this.DataContext = this;
}
public MyCommand M1 { get;set; }
//public CMD M1 { get; set; } 把指令封装公共类里面
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。