Open Neakita opened 1 month ago
You can implement spacing using nth-child selector
You can implement spacing using nth-child selector
Are you suggesting to set default item's margin to something like 0 6 0 0 and set the first item's margin to zero with :nth-child(1) selector?
Another option, which I often use, is adding Marging to all elements, and adding negative margin on the common container. But yes, VirtualizingStackPanel.Spacing would be a really nice improvement.
Another option, which I often use, is adding Marging to all elements, and adding negative margin on the common container.
Exactly what i did for now, see Describe alternatives you've considered
section.
@Neakita maybe you want to file a PR?
@Neakita maybe you want to file a PR?
I do not exclude this possibility. I'll probably try to do this over the next few days if I don't have any difficulties cloning the repository, testing changes, or anything else.
Is your feature request related to a problem? Please describe.
When using ListBox with ItemPanel = StackPanel it's possible to use StackPanel's Spacing property for, well, adding spacing between items:
which is simple and straightforward.
But when i need virtualization i have to use VirtualizingStackPanel for ListBox's ItemPanel which doesn't have the Spacing property.
Describe the solution you'd like
Register or AddOwner of StackPanel.SpacingProperty in VirtualizingStackPanel so it's possible to set Spacing between items in VirtualizingStackPanel in the same way as it is with StackPanel:
which will require changes in Measure/Arrange code.
Describe alternatives you've considered
Simulate Spacing with ListBoxItem margin and compensation of it's margin at the start and end of the ListBox with same but negative margin:
which is an ugly crutch and will require additional markup for both Horizontal-Vertical layouts support.
Additional context
No response