locked
如何更改Appbar的触发方式

    Question

  • Hi,

    Metro上的Appbar 默认是鼠标的右键或者ctrl+z, 但是我的应用需要使用到鼠标右键事件,那么怎么样才能禁用appbar的右键弹出?  我是在顶部添加了一个部件,单击后才弹出Appbar, 所以就不需要鼠标右键弹出了。我采用的是javascript 语言进行的开发。

     非常感谢!

    Monday, March 18, 2013 2:18 AM

Answers

  • If bing.com/translator did it's job, I understand you're asking how to prevent the app bar from appearing on right-mouse clicks.

    I answered this with a tip in Chapter 7 of my free ebook (see link below), page 277 of the PDF:

    Tip
    To prevent the app bar from appearing, you can do one of two things. First, to prevent the appbar from appearing at all (for any gesture), set the app bar’s element’s winControl.disabled property to true. Second, if you want to prevent it for, say, a right-click on a particular element (such as a canvas), listen to the contextmenu (right click) event for that element and call eventArgs.preventDefault() within your handler. [That is, within the contextmenu event handler.]

    Hope that answers your question.

    Kraig

    Author, Programming Windows 8 Apps with HTML, CSS, and JavaScript, a free ebook from Microsoft Press

     


     

    • Marked as answer by wd0623 Monday, March 18, 2013 3:08 AM
    Monday, March 18, 2013 2:47 AM

All replies

  • If bing.com/translator did it's job, I understand you're asking how to prevent the app bar from appearing on right-mouse clicks.

    I answered this with a tip in Chapter 7 of my free ebook (see link below), page 277 of the PDF:

    Tip
    To prevent the app bar from appearing, you can do one of two things. First, to prevent the appbar from appearing at all (for any gesture), set the app bar’s element’s winControl.disabled property to true. Second, if you want to prevent it for, say, a right-click on a particular element (such as a canvas), listen to the contextmenu (right click) event for that element and call eventArgs.preventDefault() within your handler. [That is, within the contextmenu event handler.]

    Hope that answers your question.

    Kraig

    Author, Programming Windows 8 Apps with HTML, CSS, and JavaScript, a free ebook from Microsoft Press

     


     

    • Marked as answer by wd0623 Monday, March 18, 2013 3:08 AM
    Monday, March 18, 2013 2:47 AM
  • If bing.com/translator did it's job, I understand you're asking how to prevent the app bar from appearing on right-mouse clicks.

    I answered this with a tip in Chapter 7 of my free ebook (see link below), page 277 of the PDF:

    Tip
    To prevent the app bar from appearing, you can do one of two things. First, to prevent the appbar from appearing at all (for any gesture), set the app bar’s element’s winControl.disabled property to true. Second, if you want to prevent it for, say, a right-click on a particular element (such as a canvas), listen to the contextmenu (right click) event for that element and call eventArgs.preventDefault() within your handler. [That is, within the contextmenu event handler.]

    Hope that answers your question.

    Kraig

    Author, Programming Windows 8 Apps with HTML, CSS, and JavaScript, a free ebook from Microsoft Press

     


     

    Thank you very much. I will read this book soon.  And my thanks to you for your hard work on this great book.

    Thanks.

    Dong

    Monday, March 18, 2013 2:55 AM