Floating ListBox Elements in Silverlight
Is there a way to mimic the CSS float: left;
behavior for ListBox elements?
I have a situation where I need to display a dynamic number of buttons on a page and they all need to sit next to each other. Something like this:
---------------------------------------------
| Button 1 | Button 2 | Button 3 | Button 4 |开发者_如何学运维
---------------------------------------------
Again, the number of available buttons will not be known until run-time, so I can't just set up a grid to do this for me.
Thanks!
If you're not using the SelectedItem Property in the ListBox, I would suggest using an ItemsControl and overriding the ItemsPanel to a StackPanel with an Orientation="Horizontal" like CamronBute mentioned.
<ItemsControl>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>>
Try a StackPanel. It should allow resizing and do what you need
精彩评论