How to make listbox list items in horizontal
-
By default listbox list items in vertical. Now I want to list them in horizontal. I remember this can only be set in ListBox's Style. But I forget the full name of the Property and can not find it out in the past 2 hours. :(( Anyone know this property name?
-
By default listbox list items in vertical. Now I want to list them in horizontal. I remember this can only be set in ListBox's Style. But I forget the full name of the Property and can not find it out in the past 2 hours. :(( Anyone know this property name?
-
Is that better (or different) to using a contentpresenter, and I used a wrappanel as there were quite a few images.
Never underestimate the power of human stupidity RAH
-
Is that better (or different) to using a contentpresenter, and I used a wrappanel as there were quite a few images.
Never underestimate the power of human stupidity RAH
-
If a
VirtualizingStackPanel
has been used, I suppose there might be a performance benefit in terms of loading a large amount of data together (inside anItemsControl
). AListBox
uses this panel by default. Otherwise I'm not aware of any differences.Thanks guys. My design intention is listbox inside listbox. The items of the outer listbox binds with days. so it is better let days shown horizontal. Items of inner listbox binds with things to do in specific day. So If only a property setting can achieve it, it will save time and maintainace effort.
-
By default listbox list items in vertical. Now I want to list them in horizontal. I remember this can only be set in ListBox's Style. But I forget the full name of the Property and can not find it out in the past 2 hours. :(( Anyone know this property name?
Maybe this?
<ListBox >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>Mark Salsbery :java:
-
Maybe this?
<ListBox >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>Mark Salsbery :java:
Mark has given you the "correct" answer here. All you need to do is override the ItemsPanelTemplate. There is no need to re-invent the wheel as other posters have suggested.