Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if TEST_FAILS_ON_WINDOWS // Issue link: https://github.com/dotnet/maui/issues/34671
using System.Globalization;
using NUnit.Framework;
using UITest.Appium;
Expand Down Expand Up @@ -40,3 +41,4 @@ public void ScrollPositionIsPreservedWhenOrientationChangesToNeither()
Assert.That(scrollY, Is.GreaterThan(0d), "ScrollY should remain non-zero after setting orientation to Neither.");
}
}
#endif
13 changes: 1 addition & 12 deletions src/Core/src/Platform/Windows/ScrollViewerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,10 @@ public static void UpdateScrollBarVisibility(this ScrollViewer scrollViewer, Scr
{
if (orientation == ScrollOrientation.Neither)
{
// Use Hidden (not Disabled) so WinUI keeps the current ContentOffset instead of
// resetting it to (0,0). ScrollMode.Disabled prevents further user scrolling while
// the orientation is Neither.
scrollViewer.HorizontalScrollBarVisibility = WScrollBarVisibility.Hidden;
scrollViewer.VerticalScrollBarVisibility = WScrollBarVisibility.Hidden;
scrollViewer.HorizontalScrollMode = ScrollMode.Disabled;
scrollViewer.VerticalScrollMode = ScrollMode.Disabled;
scrollViewer.HorizontalScrollBarVisibility = scrollViewer.VerticalScrollBarVisibility = WScrollBarVisibility.Disabled;
return;
}

// When leaving Neither, restore scroll modes to Auto so that they follow
// the ScrollBarVisibility settings applied below.
scrollViewer.HorizontalScrollMode = ScrollMode.Auto;
scrollViewer.VerticalScrollMode = ScrollMode.Auto;

if (visibility == ScrollBarVisibility.Default)
{
// If the user has not explicitly set a horizontal scroll bar visibility, then the orientation will
Expand Down
Loading