To quote Queen: "I'm going slightly mad..."
I've been trying for a while to get custom toolwindow header working properly, and that is where the Queen quote comes into play.
The behavior of the custom header changes based on state of the window. What I'm trying to do, have a custom TextBlock with a different font size inside the header.
This scenario can be reproduced in the Docking Window Header QuickStart sample.
I try to set the following HeaderTemplate on the ToolWindow for Class View.
<docking:ToolWindow.HeaderTemplate>
<DataTemplate>
<TextBlock AutomationProperties.Name="Title" FontFamily="Courier New" FontStyle="Italic"
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type docking:DockingWindow}}, Path=Title, Converter={StaticResource DocumentTitleConverter}}"
TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
</DataTemplate>
</docking:ToolWindow.HeaderTemplate>
When placing the ToolWindow in AutoHide, the header disappears. When docking the window again, it is displayed properly.
Setting the Header directly when declaring the toolwindow does not produce this behavior. In my application, I want to use this template on all toolwindows (want to use a dynamic fontsize which will be a few points larger than all the other text in the application). I then declare a Style for ToolWindow with the same HeaderTemplate as specified in this post, I get the same behavior.
What is going on here? I have also tried to declare a styled TextBlock inside the header for each toolwindow and got the same disappearing behavior when autohiding. I have quite a few ToolWindows in my application, so declaring the same header multiple places is messy in my opinion.
By the way, I also tried to set the style in Generic.xaml, but then it is not applied at all. Curiouser and curiouser... Declaring it inside the DockSite works. Of course, it is only used inside this one docksite, so declaring it at application level is not really necessary.
PS: I'm using the latest release.
PS2: Setting MinWidth=50 for the TextBlock, this width is maintained. The title binding does not seem to live when autohide.
PS3: While rubber-ducking here, I found out the binding to Title can't be resolved as there is no ancestor of type DockumentWindow.
Bjørnar
[Modified at 12/07/2010 01:17 PM]