【发布时间】:2014-08-26 20:08:26
【问题描述】:
我尝试按照 Rachel Lim 关于“SingleWindow”应用程序的教程进行操作: Click for tutorial .到目前为止一切正常,但是:
按钮是垂直对齐的,我希望它们是水平的!我已经厌倦了以下内容:
<DockPanel DataContext="{StaticResource ResourceKey=MainFrameViewModel}">
<Border DockPanel.Dock="Top" BorderBrush="Black" BorderThickness="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<ItemsControl ItemsSource="{Binding PageViewModels}" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Name}"
Command="{Binding DataContext.ChangePageCommand, RelativeSource={RelativeSource AncestorType= DockPanel}}"
CommandParameter="{Binding }"
Width="200"
/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Border>
如您所见,我将 Border 中的所有内容都放入了水平方向的 StackPanel 中,但它不起作用。我已经尝试了堆栈面板的每个位置,但都没有成功!按钮总是垂直的
提前非常感谢!
【问题讨论】: