Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
154
Add Button to Non-Client Area of PaneToolWindow
posted

My product has a requirement to move from overridden Window Styles to the native Windows 7 styles for our WPF application's XamDockManager hosted panes. However, we currently have a "Collapse" functionality instead of Minimize, which keeps the window's toolbar visible, but hides the content beneath it, that users have come to rely on. We would like to add a Collapse button to the title bar (Non-Client area) of our windows without overriding the Windows Style. I have come across two articles that I intend to merge and leverage to this end, but I want to hear what you have to say on the subject.

First, this article shows how to leverage the Window Message Loop, which I intend to filter down to WM_CREATE.

Next, the Aero-supported solution in this Stack Overflow post shows how to extend a Frame into the Non-Client area of a window through the DWM.

Will this be an effective solution to my problem? Is there an easier solution besides overriding the default Window style?

Thanks.

Parents
No Data
Reply
  • 54937
    Verified Answer
    Offline posted

    I suspect you are going to have a lot of trouble implementing this. First the PaneToolWindow is not a derived Window. Instead it is a ContentControl derived class that internally is hosted in one of several possible containers depending on the application - one of which is an internal derived Window class. So you won't be able to override the OnSourceInitialized and even if you were able to I'm pretty sure that the WM_CREATE has already happened before then. If you did need to do something with the WM_CREATE then you likely would have to go even deeper into unmanaged code perhaps with a callwndproc hook. Also, the derived window that we use to host the PaneToolWindow already handles some window messages and sets properties on the derived window it uses so you'll have to be very careful as to how you handle/respond to those as we really can't support this if you hit issues. So if you have to go down this route then you should try implementing this against an "external" window (i.e. create some class that takes a Window and does whatever work is needed) and once you have the functionality working then try getting it to work with the window hosting the PaneToolWindow.

Children
No Data