Processing of Windows 10 backend buttons and Windows 10 backend buttons

Source: Internet
Author: User

Processing of Windows 10 backend buttons and Windows 10 backend buttons

More than a year ago, I wrote a 8.0 Course table for our school. Now I want to migrate it to Windows 10 and support both PC and mobile phones.

Everything was normal, but something went wrong when handling the rollback button.

In the Channel9 10166 video, Microsoft provided how to handle the mobile phone rollback button.

Is to add extension to the mobile phone in the project

Use this line of code to make a judgment at runtime

If (Windows. foundation. metadata. apiInformation. isTypePresent ("Windows. phone. UI. input. hardwareButtons ") {Windows. phone. UI. input. hardwareButtons. backPressed + = HardwareButtons_BackPressed ;}

I used this method at the beginning, but I found that this method has limitations, that is, it does not support the rollback button in the tablet mode of PC.

 

So how can we support both?

After some searches, we found that it is easy to write this article if you want to support it at the same time !!!

Var view = SystemNavigationManager. GetForCurrentView (); view. BackRequested + = View_BackRequested;

In addition, there is no need to add a reference to the extension of the mobile phone!

This event is a routing event. If you do not want to pass it to the upper layer, you must mark it

E. Handled = true;

 

Good luck! The rollback button is perfectly handled!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.