Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error adding keyboard accelerators on mobile #2801

Closed
sibille opened this issue Dec 10, 2018 · 7 comments
Closed

Error adding keyboard accelerators on mobile #2801

sibille opened this issue Dec 10, 2018 · 7 comments

Comments

@sibille
Copy link
Collaborator

sibille commented Dec 10, 2018

Keyboard accelerators added on NavViews shellpage throw error on mobile
X-Ref: microsoft/microsoft-ui-xaml#57

@crutkas
Copy link
Member

crutkas commented Dec 10, 2018

Would this need to be done via API contract? Did the dev change their min version?

@sibille
Copy link
Collaborator Author

sibille commented Dec 11, 2018

@BALAGANENGINEERING I opened this issue to track the WTS part of your issue at microsoft/microsoft-ui-xaml#57 .

As @crutkas said, I think the min target version/available api contract is the issue. KeyBoardAccelerators where introduced in 10.0.16299 (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.input.keyboardaccelerator)
Could you confirm which min target version you are using?

If that's the case, you could wrap the failing call with
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
{
.....
}

@BalaganEngg
Copy link

You are correct,
I Mentioned already 640XL.
It support upto 15063.
So i used Min version = 15063
Target Version = 17763

@sibille
Copy link
Collaborator Author

sibille commented Dec 12, 2018

Thanks @BALAGANENGINEERING, Could you resolve the problem wrapping the call with the api check?

@BalaganEngg
Copy link

@sibille
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
{
MediaPlayer.KeyboardAccelerators.Add(new KeyboardAccelerator
{
Key = Windows.System.VirtualKey.Space,
});

            MediaPlayer.KeyboardAccelerators.FirstOrDefault().Invoked += PlayPause_Invoked;
        }

Working Fine

@BalaganEngg
Copy link

@sibille Thank You Very much

@sibille
Copy link
Collaborator Author

sibille commented Dec 14, 2018

Great!

@sibille sibille closed this as completed Dec 14, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Jun 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants