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();
}
}
}