c# - 工具栏中的 WPF 按钮位置
问题描述
我有一个垂直的 ToolBarTray 和一个带按钮的 ToolBar。虽然大多数按钮必须在上部,但我需要一个(退出按钮)在底部。但都是一个接一个的往下走。你能告诉我我应该怎么做才能把最后一个按钮从主组中分开吗?
谢谢!
解决方案
您可以使用两个 ToolBarTray 来实现它,如下所示:
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ToolBarTray Grid.Row="0" Background="White" IsLocked="True" Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Left" >
<ToolBar Band="1" BandIndex="1" >
<Button Content="Cut"/>
<Button Content="Copy"/>
<Button Content="Paste"/>
</ToolBar>
</ToolBarTray>
<ToolBarTray Grid.Row="1" Background="White" IsLocked="True" Orientation="Vertical" VerticalAlignment="Bottom" HorizontalAlignment="Left" >
<ToolBar Band="1" BandIndex="1" >
<Button Content="Exit" />
</ToolBar>
</ToolBarTray>
</Grid>
推荐阅读
- java - Vaadin 10+ 树形网格:层次结构及其工作原理?
- c# - File.Exists 总是返回 false
- android - 使用约束布局,但布局仍然混乱
- r - 按行提取非缺失元素并堆叠它们
- javascript - 如何调用动作(NuxtJs)
- java - 应用程序中的 Spring Gateway 和 Spring MVC
- javascript - 即使在图像标签中,我如何添加 onclick
- javascript - 无法将 JSON 从 Javascript 解码为 PHP
- excel - 在 Tableau 中的运行总和图表上生成预测
- python - 将 Pandas 数据帧转换为 Json 达到最大递归级别