Skip to content

Commit

Permalink
fix: ProtectedCursor is now supported in Uno Platform (#433)
Browse files Browse the repository at this point in the history
* fix: ProtectedCursor is now supported in Uno Platform

* Update components/Sizers/src/SizerBase.Properties.cs

* Update components/Sizers/src/SizerBase.cs

---------

Co-authored-by: Arlo <[email protected]>
  • Loading branch information
MartinZikmund and Arlodotexe authored Jul 9, 2024
1 parent 815d629 commit c532c11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions components/Sizers/src/SizerBase.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ private static void OnOrientationPropertyChanged(DependencyObject d, DependencyP
return;
#endif

// TODO: [UNO] Only supported on certain platforms
// See ProtectedCursor here: https://github.com/unoplatform/uno/blob/3fe3862b270b99dbec4d830b547942af61b1a1d9/src/Uno.UI/UI/Xaml/UIElement.cs#L1015-L1023
#if WINAPPSDK && !HAS_UNO
#if WINUI3
// Need to wait until we're at least applying template step of loading before setting Cursor
// See https://github.com/microsoft/microsoft-ui-xaml/issues/7062
if (gripper._appliedTemplate &&
Expand Down
5 changes: 2 additions & 3 deletions components/Sizers/src/SizerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ protected override AutomationPeer OnCreateAutomationPeer()
return new SizerAutomationPeer(this);
}

// On Uno the ProtectedCursor isn't supported yet, so we don't need this value.
#if WINAPPSDK && !HAS_UNO
#if WINUI3
// Used to track when we're in the OnApplyTemplateStep to change ProtectedCursor value.
private bool _appliedTemplate = false;
#endif
Expand Down Expand Up @@ -133,7 +132,7 @@ protected override void OnApplyTemplate()

// Trigger initial state transition based on if we're Enabled or not currently.
SizerBase_IsEnabledChanged(this, null!);
#if WINAPPSDK && !HAS_UNO
#if WINUI3
// On WinAppSDK, we'll trigger this to setup the initial ProtectedCursor value.
_appliedTemplate = true;
#endif
Expand Down

0 comments on commit c532c11

Please sign in to comment.