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

[Preview4] Window.Current is null #4177

Closed
sonnemaf opened this issue Feb 12, 2021 · 4 comments
Closed

[Preview4] Window.Current is null #4177

sonnemaf opened this issue Feb 12, 2021 · 4 comments
Labels
product-winui3 WinUI 3 issues team-Reach Issue for the Reach team version-winui3preview4 WinUI 3 Preview 4 issues

Comments

@sonnemaf
Copy link
Contributor

Describe the bug
The Window.Current is 'null in a Desktop project. I use it to retrieve whether the Ctrl and Shift keys are Down. Using CoreWindow.GetKeyState(). I hope there is an workaround for retrieving the KeyState.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Build a Preview 4 WinUI app.
  2. Inspect the Microsoft.UI.Xaml.Window.Current property.

Expected behavior
It should not be null

Screenshots
image

Version Info

NuGet package version:
[Microsoft.WinUI 3.0.0-preview4.210210.4]

Windows app type:

UWP Win32
No Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
October 2020 Update (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Feb 12, 2021
@sonnemaf
Copy link
Contributor Author

@azchohfi found a workaround for my GetKeyState() problem. I should use KeyboardInput.GetKeyStateForCurrentThread() instead. Thanks you.

https://twitter.com/AlexandreChohfi/status/1360274722517254145

@StephenLPeters StephenLPeters added version-winui3preview4 WinUI 3 Preview 4 issues product-winui3 WinUI 3 issues labels Feb 13, 2021
@StephenLPeters
Copy link
Contributor

@anawishnoff FYI @MikeHillberg

@StephenLPeters StephenLPeters added the team-Reach Issue for the Reach team label Feb 13, 2021
@MikeHillberg
Copy link
Contributor

We're working on documentation to list the APIs that behave differently on Desktop compared to UWP (several new to Preview4), we'll make sure this one is there.

@ghost ghost removed the needs-triage Issue needs to be triaged by the area owners label Feb 13, 2021
@krschau
Copy link
Contributor

krschau commented Jul 16, 2021

We're working on documentation to list the APIs that behave differently on Desktop compared to UWP (several new to Preview4), we'll make sure this one is there.

Here's the doc: https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-supported-api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product-winui3 WinUI 3 issues team-Reach Issue for the Reach team version-winui3preview4 WinUI 3 Preview 4 issues
Projects
None yet
Development

No branches or pull requests

4 participants