I am new to wpf. I have to create a floating ToolBar in wpf like the ms - office 2003 toolbar.
So that I can place it anywhere top - bottom, left- right as same as it was in office 2003.
Please help me .......................
For the plain docking you would use the DockPanel:
<DockPanel>
<Button DockPanel.Dock="Top">This would be a toolbar at the top</Button>
<Butto>This would the main work area</Button>
</DockPanel>
<DockPanel>
<Button DockPanel.Dock="Left">This would be a toolbar at the left</Button>
<Button>This would the main work area</Button>
</DockPanel>
Instead of Button you would of course use the classes that are more apropriate for your needs.
However when you needs a windowing system with floating windows you will have to revert to a 3rd party library because it WPF does not have it and it would be pretty hard to roll your own. Here are some libs:
If all you really need is the docking floating toolbar (and no other windows) you can use the ToolBar class in conjunction with the ToolBarTray class. But you will need to write code to detect the drag, remove the ToolBar element from the visual tree, and then add it as a root visual to your own Window or HwndSource. You'll then need to detect when the window is over your drop zone to move the ToolBar from the window to the main window's visual tree and close the other window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With