如何动态调整 ToolBarTray 方向?

发布于 2024-09-02 18:34:48 字数 85 浏览 3 评论 0原文

我正在尝试动态设置 ToolBarTray 方向,以便我可以创建自动调整的工具栏,与 Microsoft Office 2003 相同。我该如何执行此操作?

I am trying to set ToolBarTray orientation dynamically, so that I can create an auto-adjusted toolbar, same as Microsoft Office 2003. How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

街角迷惘 2024-09-09 18:34:48

您还没有告诉我们什么实际上应该触发方向的改变。但是假设它取决于托盘在 DockPanel 中停靠的位置,您可以绑定到 DockPanel.Dock 附加属性:

<ToolBarTray Orientation={Binding (DockPanel.Dock), Converter={StaticResource myDockToOrientationConverter}} />

myDockToOrientationConverter 是您必须编写一个 IValueConverter 来将 Dock.LeftDock.Right 转换为 Orientation.Vertical 和 <代码>Dock.Top 和Dock.BottomOrientation.Horizo​​ntal

You haven't told us what actually should trigger the change of the orientation. But suppose it depends on the place where the tray is docked in a DockPanel, you could bind to the DockPanel.Dock attached property:

<ToolBarTray Orientation={Binding (DockPanel.Dock), Converter={StaticResource myDockToOrientationConverter}} />

myDockToOrientationConverter is a IValueConverter you will have to write that converts Dock.Left and Dock.Right to Orientation.Vertical and Dock.Top and Dock.Bottom to Orientation.Horizontal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文