如何动态调整 ToolBarTray 方向?
我正在尝试动态设置 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还没有告诉我们什么实际上应该触发方向的改变。但是假设它取决于托盘在 DockPanel 中停靠的位置,您可以绑定到 DockPanel.Dock 附加属性:
myDockToOrientationConverter 是您必须编写一个
IValueConverter
来将Dock.Left
和Dock.Right
转换为Orientation.Vertical
和 <代码>Dock.Top 和Dock.Bottom
到Orientation.Horizontal
。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 theDockPanel.Dock
attached property:myDockToOrientationConverter
is aIValueConverter
you will have to write that convertsDock.Left
andDock.Right
toOrientation.Vertical
andDock.Top
andDock.Bottom
toOrientation.Horizontal
.