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

'ProtectedCursor': is not a member of 'winrt::Microsoft::UI::Xaml::UIElement' #9277

Closed
levinli303 opened this issue Jan 23, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@levinli303
Copy link
Member

Describe the bug

In cpp, UIElement.ProtectedCursor() throws compiler error 'ProtectedCursor': is not a member of 'winrt::Microsoft::UI::Xaml::UIElement' on 1.4.4

Steps to reproduce the bug

As in the description

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.4.4: 1.4.231219000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@levinli303 levinli303 added the bug Something isn't working label Jan 23, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 23, 2024
@DarranRowe
Copy link

DarranRowe commented Jan 23, 2024

Screenshot 2024-01-23 140552

Downgrade C++/WinRT if you want this, this is a breaking change in the C++ projection. (Edited to be consistent with the post by @sylveon.)

@sylveon
Copy link
Contributor

sylveon commented Jan 23, 2024

This is not a bug, it's an intended change. ProtectedCursor is protected so it should've never been exposed publicly in the first place.

The proper way is to do it like in C#, by inheriting from the UI element.

You can also do element.as<IUIElementProtected>().ProtectedCursor() to minimize code changes on your end, but it's more of a workaround/hack.

@sylveon
Copy link
Contributor

sylveon commented Jan 23, 2024

There's a bigger question about whether or not this member should be made public in a future WASDK update (so that C# users can also enjoy being able to set the cursor without inheritance), or a better API for setting the cursor introduced.

@levinli303
Copy link
Member Author

thanks for the workaround. yeah it would be best for there to be public API to change cursors. I can close this if you think that a public API should be tracked in a different issue.

@codendone
Copy link
Contributor

A public UIElement.Cursor property remains a desired API addition on the backlog (internal tracking item). We don't have a timeline for that currently. I don't see a "feature proposal" tracking that in this repo; feel free to log that, if desired.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the needs-triage Issue needs to be triaged by the area owners label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants