覆盖 UserControl 中的 OnBackKeyPress 事件

Override OnBackKeyPress event in UserControl

我可以通过任何其他方式关闭返回键上的用户控件弹出窗口 ,在简单的页面中我们可以通过OnBackKeyPress事件来做到这一点。

请仔细阅读以下内容。 VehicalPopup 是弹出窗口,我想在后退键上关闭它并取消从 userconrol

返回的导航
  protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
    {
        //Do your work here
        // base.OnBackKeyPress(e);
        if (VehicalPopUp.IsOpen)
        {
            Popup__ShowHide(false);
            e.Cancel = true;
        }
    }

用户控件没有 onBackKeyPress 事件请帮我解决这个问题

这可以从使用用户控件的页面完成。

 if (UserControlName.VehicalPopUp.IsOpen)
        {
            UserControlName.Popup__ShowHide(false);
            e.Cancel = true;
        }