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
Expand Up @@ -98,7 +98,14 @@ protected override void OnScrollViewerFound(ScrollViewer scrollViewer)
_scrollViewer.ViewChanged += OnScrollViewChanged;
_scrollViewer.SizeChanged += OnScrollViewSizeChanged;

UpdateScrollBarVisibilityForLoop();
if (Element.Loop)
{
UpdateScrollBarVisibilityForLoop();
}
else
{
UpdateScrollBarVisibility();
}
}

protected override ICollectionView GetCollectionView(CollectionViewSource collectionViewSource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,7 @@ protected virtual void UpdateItemsLayout()

UpdateItemTemplate();
UpdateItemsSource();
UpdateVerticalScrollBarVisibility();
UpdateHorizontalScrollBarVisibility();
UpdateScrollBarVisibility();
UpdateEmptyView();
}

Expand All @@ -376,6 +375,12 @@ void ListViewLoaded(object sender, RoutedEventArgs e)
listView.Loaded += ListViewLoaded;
}

internal void UpdateScrollBarVisibility()
{
UpdateVerticalScrollBarVisibility();
UpdateHorizontalScrollBarVisibility();
}

void UpdateVerticalScrollBarVisibility()
{
if (Element.VerticalScrollBarVisibility != ScrollBarVisibility.Default)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue15253.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using System.Collections.ObjectModel;

namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 15253, "[Windows]HorizontalScrollBarVisibility doesnot works", PlatformAffected.UWP)]

public class Issue15253 : ContentPage
{
ObservableCollection<Model15253> Items;
public Issue15253()
{
Items = new ObservableCollection<Model15253>();
Items.Add(new Model15253 { Name = "one", AutomationId = "15253One" });
Items.Add(new Model15253 { Name = "two", AutomationId = "15253Two" });
Items.Add(new Model15253 { Name = "three", AutomationId = "15253Three" });
var carouselView = new CarouselView
{
WidthRequest = 200,
HeightRequest = 200,
AutomationId = "15253CarouselView",
Loop = false,
VerticalScrollBarVisibility = ScrollBarVisibility.Never,
HorizontalScrollBarVisibility = ScrollBarVisibility.Never,
BackgroundColor = Colors.LightBlue,
ItemsSource = Items,
ItemTemplate = new DataTemplate(() =>
{
var label = new Label
{
FontSize = 32,
TextColor = Colors.Black,
HorizontalTextAlignment = TextAlignment.Center,
BackgroundColor = Colors.LightBlue

};
label.SetBinding(Label.TextProperty, "Name");
label.SetBinding(Label.AutomationIdProperty, "AutomationId");

var stack = new StackLayout
{
Orientation = StackOrientation.Vertical,
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
WidthRequest = 200,
Children = { label }
};
return new ContentView { Content = stack };
})
};


var toggleButton = new Button
{
Text = "Toggle Scrollbar",
AutomationId = "15253Button"
};

toggleButton.Clicked += (s, e) =>
{
carouselView.HorizontalScrollBarVisibility = carouselView.HorizontalScrollBarVisibility == ScrollBarVisibility.Never
? ScrollBarVisibility.Always
: ScrollBarVisibility.Never;
};

var outerStack = new StackLayout
{
Orientation = StackOrientation.Vertical,
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
Spacing = 8,
Padding = 8,
Children = { toggleButton, carouselView }
};

Content = outerStack;
}

}
public class Model15253
{
public string Name { get; set; }
public string AutomationId { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ public partial class Issue28098 : ContentPage
public Issue28098()
{
InitializeComponent();
#if ANDROID
carouselView.HorizontalScrollBarVisibility = ScrollBarVisibility.Never;
#endif
}

protected override void OnAppearing()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using NUnit.Framework;
using UITest.Core;
using UITest.Appium;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
internal class Issue15253 : _IssuesUITest
{
public override string Issue => "[Windows]HorizontalScrollBarVisibility doesnot works";
public Issue15253(TestDevice device) : base(device)
{
}

[Test]
[Category(UITestCategories.CarouselView)]
public void HorizontalScrollBarShouldHideOnNever()
{
// Is a Windows issue; see https://github.com/dotnet/maui/issues/15253
App.WaitForElement("15253CarouselView");
App.Tap("one");
VerifyScreenshot();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ public void BlankScreenOnNavigationBack()
App.Tap("Button");
App.WaitForElement("BackButton");
App.Tap("BackButton");
#if WINDOWS
VerifyScreenshot(cropBottom: 250);
#else
VerifyScreenshot();
#endif
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading