locked
How to Horizontally display the data by the listbox? RRS feed

  • Question

  •  <ListBox x:Name="imageListBox" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility = "Disabled">
                        <ListBoxItem>first</ListBoxItem>
                        <ListBoxItem>second</ListBoxItem>
                    </ListBox>

    The effect like this:

    first

    second

    but I need this:

    first          second

    Tuesday, December 17, 2013 12:24 PM

Answers

  • <ListBox x:Name="imageListBox" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility = "Disabled" IsSynchronizedWithCurrentItem="False">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBoxItem>first</ListBoxItem>
            <ListBoxItem>second</ListBoxItem>
            </ListBox>
    This should work for you!
    Tuesday, December 17, 2013 1:30 PM