我有一个StackPanel,它被我用作ContentControl。我有一个地方需要根据我绑定的数据生成按钮,这一切都很顺利,但我希望按钮水平排列,而不是垂直排列,目前的情况正是这样。以下是屏幕截图:
这是我的ContentTemplate描述中的代码:
![alt text](https://img.photobucket.com/albums/v428/acousticshredder/releaseButtons.jpg)
<StackPanel Name="wpReleaseButtons" Orientation="Horizontal" Grid.Row="2">
<ItemsControl IsTabStop="False" ItemsSource="{Binding Path=BranchCommands}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Tag="{Binding}" Padding="3">
<TextBlock Text="{Binding Path=DisplayValue}" />
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
我不确定我在这里做错了什么。希望能得到任何信息,非常感谢。