@kubakista was right about
It looks like if ListView.ItemsPanel contains ItemsStackPanel, then GroupStyle.Panel is ignored ...
However, changing this will not solve your problem, because -
- Scrolling becomes a little lagged.
- No horizontal scrolling.
ListView loses virtualization.- The beautiful animation for the group header has been removed.
Here is an alternative without changing the structure of the ListView itself, but slightly altering your data structure.
The idea is to consider each horizontal list of rectangles under a group as one collection item in the user interface.
This means that each group in the ListView will have only one child, which is actually a set of rectangles that will be represented in the horizontal scrollable ItemsControl .
So, suppose you have a collection of type ObservableCollection<Item> as CollectionViewSource , Item will now become a type of <ObservableCollection<Item>> to save the collection of rectangles. Therefore, the collection type will need to be updated to the value ObservableCollection<ObservableCollection<Item>> .
Inside the ListView ItemTemplate you need to create a horizontal scroll of the ScrollViewer and place it inside the ItemsControl . Make sure you set the last ItemsSource to {Binding} .
To enable horizontal scrolling, you need to disable the tilt effect by editing the default ListViewItem style and commenting out the following code.
I attached a working example of the project here , as well as the screenshot shown below.

Hope this helps!
source share