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 @@ -235,11 +235,11 @@ void UpdateIsSwipeEnabled()
{
case ItemsLayoutOrientation.Horizontal:
ScrollViewer.SetHorizontalScrollMode(ListViewBase, ItemsView.IsSwipeEnabled ? WScrollMode.Auto : WScrollMode.Disabled);
ScrollViewer.SetHorizontalScrollBarVisibility(ListViewBase, ItemsView.IsSwipeEnabled ? WScrollBarVisibility.Auto : WScrollBarVisibility.Disabled);
ScrollViewer.SetHorizontalScrollBarVisibility(ListViewBase, ItemsView.IsSwipeEnabled ? WScrollBarVisibility.Auto : WScrollBarVisibility.Hidden);
break;
case ItemsLayoutOrientation.Vertical:
ScrollViewer.SetVerticalScrollMode(ListViewBase, ItemsView.IsSwipeEnabled ? WScrollMode.Auto : WScrollMode.Disabled);
ScrollViewer.SetVerticalScrollBarVisibility(ListViewBase, ItemsView.IsSwipeEnabled ? WScrollBarVisibility.Auto : WScrollBarVisibility.Disabled);
ScrollViewer.SetVerticalScrollBarVisibility(ListViewBase, ItemsView.IsSwipeEnabled ? WScrollBarVisibility.Auto : WScrollBarVisibility.Hidden);
break;
}
}
Expand Down
60 changes: 60 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue29216.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using Maui.Controls.Sample.Issues;

namespace Controls.TestCases.HostApp.Issues;

[Issue(IssueTracker.Github, 29216, "Carousel view scrolling on button click", PlatformAffected.UWP)]
public class Issue29216 : TestContentPage
{
protected override void Init()
{
var items = new List<string> { "Page1", "Page2" };

CarouselView carouselView = new CarouselView
{
ItemsSource = items,
IsSwipeEnabled = false,
Loop = false,
ItemTemplate = new DataTemplate(() =>
{
var label = new Label
{
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
FontSize = 24,
TextColor = Colors.Black,
};

label.SetBinding(Label.TextProperty, ".");
label.SetBinding(Label.AutomationIdProperty, ".");

return new StackLayout
{
Children = { label }
};
}),
HeightRequest = 300
};

var button1 = new Button
{
Text = "Go to Page 2",
AutomationId = "button"
};

button1.Clicked += (s, e) => carouselView.Position = 1;

Content = new StackLayout
{
Padding = 20,
Children =
{
new StackLayout
{
Orientation = StackOrientation.Horizontal,
Children = { button1 }
},
carouselView
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue29216 : _IssuesUITest
{
public Issue29216(TestDevice device) : base(device)
{
}

public override string Issue => "Carousel view scrolling on button click";

[Test]
[Category(UITestCategories.CarouselView)]
public void Issue29216CarouselViewScrollingIssue()
{
App.WaitForElement("button");
App.Tap("button");
App.WaitForElement("Page2");
}
}
Loading