ashish semwal
ashish semwal

Reputation: 99

how can I adjust the ToolBarTray orientation dynamically?

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

Answers (1)

bitbonk
bitbonk

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

Related Questions