【问题标题】:How do you bind Enter and Esc keys to OK and Cancel buttons respectively in a WPF dialog?如何在 WPF 对话框中分别将 Enter 和 Esc 键绑定到 OK 和 Cancel 按钮?
【发布时间】:2010-01-08 22:46:28
【问题描述】:

我的 WPF 应用程序使用带有确定和取消按钮的对话框。我想将 Enter 键绑定到 Ok 按钮,将 Esc 键绑定到 Cancel 按钮。看起来应该是一件很简单的事情。

【问题讨论】:

    标签: .net wpf key-bindings


    【解决方案1】:

    尝试将确定按钮上的IsDefault 属性设置为true,并将取消按钮上的IsCancel 属性设置为true。

    【讨论】:

      猜你喜欢
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 2019-01-30
      • 2017-04-13
      • 2014-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多