How to use content scrolling with a UniformGrid?
Posted: 26 Feb 2021, 21:31
I have a UniformGrid with a set number of columns. On screen, two rows at max can show. When the grid becomes three rows, I want to content scroll one row at a time.
What it looks like before the third row: https://i.imgur.com/Z8uDeET.png
What it looks like with the third row: https://i.imgur.com/4aY3x8o.png
Instead of shrinking the height of the elements, it should keep the same height and allow you to scroll down a row. Is this possible?
What it looks like before the third row: https://i.imgur.com/Z8uDeET.png
What it looks like with the third row: https://i.imgur.com/4aY3x8o.png
Instead of shrinking the height of the elements, it should keep the same height and allow you to scroll down a row. Is this possible?
Code: Select all
<ItemsControl>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
Columns="6"
ScrollViewer.CanContentScroll="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer
CanContentScroll="True"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Visible">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemTemplate>
<DataTemplate>
...
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>