C# 在弹出消息框时允许功能快捷键

C# 在弹出消息框时允许功能快捷键,c#,messagebox,C#,Messagebox,当用户输入不正确的值时,将显示一个消息框并显示“条目不匹配。是否要覆盖?”。当此消息框出现时,我希望用户能够按F1键,并在显示时显示单独的页面,而无需关闭消息框。这是可能的方式,我有我的代码或我需要重组整个交易 if (MessageBox.Show("Entry not a match. Do you want to overwrite?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { //b

当用户输入不正确的值时,将显示一个消息框并显示“条目不匹配。是否要覆盖?”。当此消息框出现时,我希望用户能够按F1键,并在显示时显示单独的页面,而无需关闭消息框。这是可能的方式,我有我的代码或我需要重组整个交易

if (MessageBox.Show("Entry not a match. Do you want to overwrite?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {   //below is the code I want to use as the shortcut for when the messae box appears if it is possible to do it this way

if (e.Key == Key.F1)
        {
            viewEntry page = new viewEntry ();
            page.textBox.Text = textBox.Text;
            page.ShowDialog();
        }
                    if (MessageBox.Show("Confirm Overwrite", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        //do something

                    }
                    tnImage.Text = "✓";
                    tnImage.FontSize = 22;
                    tnImage.Foreground = new SolidColorBrush(Colors.Green);
                    txtTN.BorderBrush = new SolidColorBrush(Colors.Green);
                    txtBN.Focus();
                }
                else
                {
                    return;
                }

我想你必须实现你自己的自定义
MessageBox
,它允许你按F1键并显示另一个窗口,这就是我所想的,但我不确定我是否能通过这种方式