覆盖UserControl中的OnBackKeyPress事件

时间:2015-03-20 07:50:09

标签: c# windows-phone-8

还有其他方法可以关闭后退键上的usercontrol弹出窗口 ,在简单的页面中,我们可以通过OnBackKeyPress事件来完成。

请仔细阅读以下内容。 VehicalPopup是popup,我想在反向键上关闭它并取消从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;
        }
    }

UserControl没有onBackKeyPress事件请帮我解决这个问题

1 个答案:

答案 0 :(得分:0)

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

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