Assign a PreviewKeyDown event to the window in XAML, then check the KeyEventArgs in the code to determine if the user has pressed the Enter key.
XAML Code:
<Window [...] PreviewKeyDown="Window_PreviewKeyDown">
Code behind:
private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) {
ihatemash Nov 16 '10 at 13:17 2010-11-16 13:17
source share