Remove Docking Buttons

Feb 24, 2009 at 8:49 PM
I would like to remove two of the buttons on DockablePane.  The two buttons are the triangle which allows the context menu to display and the x which allows the user to close the pane.

The desire is to allow the user to pin or un-pin the panel but not allow them to close it, change it to a floating window, or change the dock location.

Thanks.
Feb 26, 2009 at 4:12 PM
You need to restyle the DockablePane class removing buttons/menu items you are not interested in. In next version I plan to add a property like IsCloseable which returns false if pane is not closeable and attach the relative template to it in order to hide close button.

Thanks,
Ado
Mar 7, 2009 at 11:43 PM
Do you have a template posted anywhere that I can use to hide the close button and the context menu?
May 7, 2009 at 4:39 PM
Edited May 8, 2009 at 1:53 PM

Hey Ado,

I've tried modifying the template for the DockablePane like you recommended above, and it works, but only when the pane is not in auto-hide mode.  If I auto-hide the pane, and then hover over the pane, the removed buttons come back.  Can you think of why this would happen?  Is it related to this (http://avalondock.codeplex.com/Thread/View.aspx?ThreadId=43898)?  I had the templates declared within the scope of the application, so I don't know how that could be the problem.  Also, is that IsClosable still in the works?  If not, could you give me some tips on how I can implement it myself?  Thanks in advance.  This project of yours has helped a ton.

-Matt

May 20, 2009 at 1:01 PM

Has anyone been able to get this to work?

May 20, 2009 at 1:44 PM

I've just posted an issue http://avalondock.codeplex.com/Thread/View.aspx?ThreadId=56825

which I think is probably the cause of your issue, and maybe http://avalondock.codeplex.com/Thread/View.aspx?ThreadId=43898.

When autohidden the DockableContext is removed and placed in a FlyoutDockablePane. This class is internal and cannot be styled. I downloaded the source, modified this to public and copied my DocakblePane style to a FlyoutDockablePane style. This fixed my problem. I'm not sure why this class in marked as internal, though I haven't delved too deep into the workings so I'm not sure if my change will break anything else.

 

Cheers

SC

May 20, 2009 at 3:14 PM

Thanks for your reply, SC.  Yeah, it sounds like the exact same issue.  I'll give your solution a shot when I get some time.  Thanks again!