I want to implement an horizontal ListView
which can have multiple lines, like the file explorer:
I found that I have to use StackPanel
for the ItemPanelTemplate
here, but I prefer to have multiple lines instead of the horizontal scrollbar.
I think that the idea is when the StackPanel width reaches the ListView width, go the next line/create a new StackPanel. I don't know if it's correct, but maybe it can help to understand what am I looking for.
How can I implement this?
You need to use a WrapPanel
instead of a StackPanel
as ItemsPanelTemplate
.
<ListView ItemsSource="{Binding xxx}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>