开发者

How to stop reloading the page when the user press F5 or CTRL+R in XBAP Application

I have an XBAP Application.

In XBAP Page, if th开发者_JAVA百科e user presses F5 or CTRL+R then the confirmation message must be shown to the user.

If Yes then the page must be reloded.

If No then the current page must remain as it is.

Can any one help how to do this.


You could call on NavigationMode of Navigating event parameter, like code below shows,

Application.Current.Navigating += new NavigatingCancelEventHandler(Current_Navigating);

  void Current_Navigating(object sender, NavigatingCancelEventArgs e)
  {
   if (e.NavigationMode == NavigationMode.Refresh)
   {
    //put your logic here
   }
  }

If user trigger refresh operation either by F5 or Ctrl+R combination keys, you could catch this event and handle it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜