tags:

views:

334

answers:

1

Hi

How to set the orientation of the List box in Silverlight i.e how to display the datas horizantally

Thanks in advance

+4  A: 

Modify the ItemsPanel of the ListBox and set it to a StackPanel that's oriented Horizontally:

<ListBox>
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
</ListBox>
James Cadd
+1 - beat me to it! :)
Andy
I thought it would be answered before I could hit "post!"
James Cadd
ok, more elegant solution than mine. But my idea still works. ;-)
scottmarlowe
Scott, the answer you provided may look like horizontal listbox, but really that is not. You cant do a DataBinding on the listbox. The default panel associated with a listBox is StackPanel with Vertical orientation so just make that horizontal is the only right answer.
Jobi Joy
nobody said anything about data binding. just kidding.
scottmarlowe
i noticed that your example wasn't letting the user select those listboxitems separately but i wasn't going to say anything ;)
James Cadd