所以我有一个 StackPanel,用作 ContentControl。我有一个地方,我希望根据我绑定的数据生成按钮,这一切都很好,但我希望按钮水平布局,而不是像当前正在发生的那样垂直布局。这是一个屏幕截图:
这是我的 ContentTemplate 描述中的代码:
<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>
不知道我在这里做错了什么。任何信息,将不胜感激。谢谢!