Here I just implemented ICommand, and kept everything default. I created a custom event EventHandler called OnHidden that will get call when the floating window is hidden or closed by a user.
[Export(typeof(ICommand))]That's It. It's very easy to do, and helpful in some instances.
[DisplayNameAttribute("This is a Demo")]
public class cmdGenerateExcelTemplate : ICommand
public bool CanExecute(object parameter)
public event EventHandler CanExecuteChanged;
public event EventHandler OnHidden;
public void Execute(object parameter)
MapApplication.Current.ShowWindow("This is my control",
this.OnHidden += new EventHandler(cmdGenerateExcelTemplate_OnHidden);
void cmdGenerateExcelTemplate_OnHidden(object sender, EventArgs e)
MessageBox.Show("I'm hidden now!");