Gaps between items in my ListBox

Posted by drasto on Stack Overflow See other posts from Stack Overflow or by drasto
Published on 2011-01-16T05:40:22Z Indexed on 2012/11/03 23:01 UTC
Read the original article Hit count: 345

Filed under:
|
|
|
|

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:

Picture showing gaps

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.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf