views:

1792

answers:

2

Do you know any controls inherited from the ItemsControl that have horizontal orientation of items?

+28  A: 

Simply change the panel used to host the items:

<ItemsControl ...>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ItemsControl>

HTH, Kent

Kent Boogaart
Don't you need to add IsItemsHost="True" to the StackPanel ?
Thomas Levesque
I believe that's only necessary if you're re-templating the entire control. See http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemspanel.aspx
Kent Boogaart
Answer also holds for Silverlight
Scott
A: 

this is actually not going to work in many situations.

using a stackpanel means the contents won't stretch to fill the space.

you then have to set a fixed width on anything in the itemtemplate.

silverlame