Live Chat Icon For mobile
Live Chat Icon

How do I display items in a ListBox horizontally?

Platform: WPF| Category: ListBox

Items can be displayed horizontally using the ItemsPanel property of the ListBox.

The following lines of code are used to display the items horizontally.

[XAML]

<ListBox Height='40' Width='50'>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
            	<StackPanel Orientation='Horizontal'/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
      <ListBoxItem>1 ITEM 1</ListBoxItem>
<ListBoxItem>2 ITEM 2</ListBoxItem>
<ListBoxItem>3 ITEM 3</ListBoxItem>
</ListBox>

Share with

Share on twitter
Share on facebook
Share on linkedin