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?
+2
A:
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.
bitbonk
2010-05-24 19:52:34