Hello there,
I am having trouble getting the window title displaying what I want.
As long as I only set the ContentPane's header to some static string - everything is fine. But I wanted to bind the content of the pane header to some property.
So I used the TabHeader property to display the static string, and the Header to display something more complex.
Problem is - when I float the DockPanel - the title is: "System.Windows.Controls.DockPanel".
However, we have not been able to figure out to display the TabHeader in the floating window title (I believe that is what should happen).
We played around with the several different templates that you can define with no luck so far.
Thanks in advance,
Hinrich
The TabHeader is only for the TabItem header - i.e. the tab that is displayed to represent a ContentPane when it is part of a tab group such as the tab item in the unpinned tab area when it is unpinned or the tabitem displayed when it is in a tabgroup that is docked/floating or in the DocumentContentHost. It is not used to affect the header of a floating window.
With regards to the floating window header, by default the xamDockManager allows the OS to provide the non-client area. That means that elements cannot be displayed in that area so when the Title of the hosting window is setup it is bound to the Header but must show a string so ultimately it ends up using the ToString of the value. Even when the UseOsNonClientArea of the PaneToolWindow (which can be set in the ToolWindowLoaded event) is set to false the Title of the PaneToolWindow is just a string so the same thing would happen.
Back in June we did add a FloatingWindowCaptionSource to the XamDockManager which would allow one to hide the PaneToolWindow's "non-client area" (and therefore force using UseOsNonClientArea of false) and instead show the PaneHeaderPresenter of the ContentPane when there is only a single ContentPane in view in the PaneToolWindow. To do that one would set this property to UseContentPaneCaption. Note that would still end up using the Header but if you had complex content then it would be displayed and not just the ToString.
BTW I'm not sure to what you are binding the Header but I would highly recommend not putting Visuals/UIElements into the Header property directly. A Visual can only be displayed in one element and further the ContentPane is a HeaderedContentControl and the base class will try to make the value of the Header to be the logical child of the element and an object can only have one logical parent or else an exception will be generated. The Header is used not only for the header of the pane but also for the header displayed in the pane navigator (e.g. Ctrl+Tab window) so you could end up crashing your application. Typically when one wants to put elements into something like this one would set the HeaderTemplate to a DataTemplate that contains the desired visuals (or the Header is bound to a custom object and there is a default DataTemplate defined for that type).
Hi Hinrich,
Let us know if you have any questions on what Andrew posted.
Do you still require assistance on this?