UIElement.ProtectedCursor -- why so insanely complicated? (why is it protected) #2495
Replies: 1 comment 3 replies
-
I want to add my perspective to the above request in the hopes that changes will be made to simplify current coding procedures. I am currently upgrading my app and class library from WinAppSDK 1.0 (experimental) to the latest version 1.1. My class library consisted of many custom controls made up of existing controls e.g. Buttons, TextBlocks., Images.. When the mouse was hovered over the custom control, I could change the cursor with 1 line of code:
As stated in original post above, I now must make a subclass of all controls I use in order to access ProtectedCursor , just so I can change the cursor. This could be 30+ controls. The ability to change the cursor in a GUI library is a basic function. Exposing the above property would accomplish that. |
Beta Was this translation helpful? Give feedback.
-
I wanted, what to me sounded like an easy thing to have, but it seems I'm always asking too much.
To the point: i have a few buttons in a user control, and I want to set the cursor for some of them to "Hand".
So, in WPF, we've had for ages, a simple dependency property,
Cursor
-- not only that, but you can set it to your heart's desire, even to different cursors, depending on your position.In UWP, at some point, the Windows Toolkit had an attached property
Mouse.Cursor
, which would achieve more or less the same thing.But in WinUI3, we have
.ProtectedCursor
, so basically, I can't simply do this generically, like, for some of the buttons I choose. I simply fail to understand why this is a protected method.Not only that, but you can't call it unless the control is fully loaded, otherwise it'll generate an Access Violation, which obviously isn't documented anywhere.
Beta Was this translation helpful? Give feedback.
All reactions