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 @@ -195,7 +195,7 @@ protected virtual void UpdateFooter()

static ListViewBase CreateGridView(GridItemsLayout gridItemsLayout)
{
return new FormsGridView
var gridView = new FormsGridView
{
Orientation = gridItemsLayout.Orientation == ItemsLayoutOrientation.Horizontal
? Orientation.Horizontal
Expand All @@ -204,6 +204,14 @@ static ListViewBase CreateGridView(GridItemsLayout gridItemsLayout)
Span = gridItemsLayout.Span,
ItemContainerStyle = GetItemContainerStyle(gridItemsLayout)
};

if (gridView.Orientation == Orientation.Horizontal)
{
ScrollViewer.SetVerticalScrollMode(gridView, WScrollMode.Disabled);
ScrollViewer.SetHorizontalScrollMode(gridView, WScrollMode.Auto);
}

return gridView;
}

static ListViewBase CreateVerticalListView(LinearItemsLayout listItemsLayout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,53 @@ bool listIsDoneGrowing()
});
}

[Fact]
public async Task ValidateCorrectHorzScroll()
{
SetupBuilder();
ObservableCollection<string> data = new ObservableCollection<string>()
{
"Item 1",
"Item 2",
"Item 3"
};

var collectionView = new CollectionView()
{
ItemTemplate = new Controls.DataTemplate(() =>
{
return new VerticalStackLayout()
{
new Label()
};
}),
ItemsSource = data,
ItemsLayout = new GridItemsLayout(ItemsLayoutOrientation.Horizontal)
{
Span = 2,
HorizontalItemSpacing = 4,
VerticalItemSpacing = 4
}
};

var layout = new VerticalStackLayout()
{
collectionView
};
await CreateHandlerAndAddToWindow<LayoutHandler>(layout, async (handler) =>
{
await Task.Delay(100);

var cvHandler = (CollectionViewHandler)collectionView.Handler;
var control = cvHandler.PlatformView;

var horzScrollMode = (Microsoft.UI.Xaml.Controls.ScrollMode)control.GetValue(UI.Xaml.Controls.ScrollViewer.HorizontalScrollModeProperty);
var vertScrollMode = (Microsoft.UI.Xaml.Controls.ScrollMode)control.GetValue(UI.Xaml.Controls.ScrollViewer.VerticalScrollModeProperty);
Assert.True(horzScrollMode == UI.Xaml.Controls.ScrollMode.Auto);
Assert.True(vertScrollMode == UI.Xaml.Controls.ScrollMode.Disabled);
});
}

[Fact]
public async Task ValidateSendRemainingItemsThresholdReached()
{
Expand Down