#998 – Orient a ListBox Horizontally
January 30, 2014 3 Comments
You can make a ListBox render its items horizontally, rather than vertically, by setting its ItemsPanel.
In the example below, we set the ItemsPanel to a template containing a horizontally-oriented StackPanel. (The default is a vertically-oriented StackPanel).
<ListBox Width="230" Height="70" ItemsSource="{Binding ActorList}" DisplayMemberPath="LastName"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> </ListBox>
Pingback: Dew Drop – January 30, 2014 (#1713) | Morning Dew
Thanks for the great tips! This helps a lot!
You’re welcome!