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))]
[DisplayNameAttribute("This is a Demo")]
[DefaultIcon("/DemoFun;component/Images/Demo.png")]
public class cmdGenerateExcelTemplate : ICommand
{
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
public event EventHandler OnHidden;
public void Execute(object parameter)
{
MapApplication.Current.ShowWindow("This is my control",
<controlobject>,
false,
null,
OnHidden,
WindowType.Floating);
this.OnHidden += new EventHandler(cmdGenerateExcelTemplate_OnHidden);
}
void cmdGenerateExcelTemplate_OnHidden(object sender, EventArgs e)
{
MessageBox.Show("I'm hidden now!");
}
That's It. It's very easy to do, and helpful in some instances.Enjoy