These are chat archives for punker76/MahApps.Metro.SimpleChildWindow

7th
Sep 2015
Jon Alza
@jonny123d
Sep 07 2015 07:12
Is it so obvious that I'm migrating from WinForm to WPF? :smile:
Jon Alza
@jonny123d
Sep 07 2015 11:41

Hello, I've noticed that the ChildWindow closes when I press the ESC key. Is there any way to avoid it? I've tried with this code, but it is useless:

public MyChildWindow()
{
    InitializeComponent();
    this.KeyDown += this.MyChildWindow_KeyDown;
}
private void MyChildWindow_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Escape)
        e.Handled = true;
}

The e.Handled = true; is executed but the window closes.

Jan Karger
@punker76
Sep 07 2015 11:53
@jonny123d you can use the new dp CloseByEscape, it's available in the alpha version (pre nuget version)
...more enhancement is coming soon...
Jon Alza
@jonny123d
Sep 07 2015 12:53
@punker76 Thank you again!
Darnell Williams
@Seeker1437
Sep 07 2015 15:32
@jonny123d before the alpha I believe the hild window was treated like a dialog in which esc key automatically meant Cancel, I don't think you can intercept that.