Reputation: 99
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?
Upvotes: 1
Views: 592
Reputation: 49629
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
.
Upvotes: 4