locked
A floating toolbar RRS feed

  • Question

  • I would like to create a toolbar that behaves the same way as toolbars in VS 2005. That is when a toolbar is drag out from the toolbar tray, I would like toolbar to appear inside a floating window. How can this be done with the WPF toolbar?

     

    Wednesday, February 28, 2007 4:14 AM

Answers

  • This functionality is not available in the base implementation of ToolBar. You can, however, 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.
    Tuesday, April 3, 2007 12:40 AM

All replies

  • This functionality is not available in the base implementation of ToolBar. You can, however, 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.
    Tuesday, April 3, 2007 12:40 AM
  • I wouldn't care about the dragging so much, I just don't know how I can handle the clicks in the lower-case pages, i.e. i have a window that contains pages; i want to move the tbt's toolbars 'up' to the window tbt, so first, i get an exception that it belongs to another visual, then i have no clue how to handle it's events on the page, since it's not going to be visible only in the window, i guess i could do this with commands; still a little bit pain tho.

    I would love to see an example if someone did this already.

    I've also posted a related question here.
    Thursday, February 4, 2010 10:23 AM