Search Results

Search found 1 results on 1 pages for 'user527403'.

Page 1/1 | 1 

  • an enter key are handled twice in WPF/Winform mixed project

    - by user527403
    I have a winform dashboard which hosts some WPF dialogs. When I select a row in the winform ListView and hit Enter key, OnItemActivate is called which launches a WPF dialog. However, the WPF dialog appears and then disappears immediately because the default button “cancel” is hit. It seems that the Enter key is triggered twice, one for launching the WPF dialog, the other for hitting cancel button. We don’t want the WPF dialog to be canceled by the Enter key hitting. According to the stack trace, it looks like that WPF and Winform handle the enter key separately. The WPF does not know that the enter key has been handled by the Winform ListView. Is this by design in Winform and WPF interop? To make the enter key not close the WPF dialog, we have to change the focus from the cancel button to another control (e.g. a textblock). Is there a better way to fix/around this issue?

    Read the article

1