Search code examples
wpfxamlavalondock

DocumentHeaderTemplate affects title set on LayoutAnchorables


I have implemented the solution given in AvalonDock2 : LayoutItemTemplate only for documents. However I have a problem with setting the title on my Documents. I have inserted a DocumentHeaderTemplate

        <xcad:DockingManager.DocumentHeaderTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Content.Name}" />
            </DataTemplate>
        </xcad:DockingManager.DocumentHeaderTemplate>

This works for my bounded documents, but overrides my Title set on my LayoutAnchorable and gives an empty title when I set this. If I remove the DocumentHeaderTemplate I get my desired title on the anchorables, but not on my documents. My LayoutAnchorable follows:

                 <xcad:LayoutAnchorable ContentId="Log" Title="Log" CanClose="False">

Solution

  • After testing more I found out the answer myself and post it here if someone got the same question.

    DocumentHeaderTemplate affects items that is placed on LayoutDocumentPane, it is not related to the Layout of the item. So if you place a LayoutAnchorable on a LayoutDocumentPane it will be affected by the DocumentHeaderTemplate.