我有一个水平的ListBox。以下是它的代码(去掉了一些无关的内容):
<ListBox Grid.Row="1"
ItemContainerStyle="{StaticResource ListBoxUnselectableItemStyle}"
ItemsSource="{Binding ...}"
BorderThickness="0"
Background="{x:Null}"
ScrollViewer.CanContentScroll="False">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"
VerticalAlignment="Top"
HorizontalAlignment="Center"
Background="Red"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
我得到的项目布局行为如下所示:
![http://www.freeimagehosting.net/uploads/cf4f839d02.png](https://istack.dev59.com/GaC6F.webp)
有人可以帮我吗?