Gaps between items in my ListBox.
- by drasto
When I create ListBox with horizontal items ordering for example like this:
<DockPanel>
<ListBox>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem>
<Button Content="Hello" />
</ListBoxItem>
<ListBoxItem>
<Button Content="Hello" />
</ListBoxItem>
</ListBox>
</DockPanel>
I have small gaps between buttons in the list as indicated by the arrows on following picture:
How can I get rid of those gaps please ? I need to have items in ListBox just next to each other. I have tried changing ItemTemplate of the ListBox but it did not help.