How do I create a custom contentpane header? I naively tried:
<ContentPane ...>
<ContentPane.Header>
<TextBox .... />
</ContentPane.Header>
</ContentPane>
But it doesn't work.
It depends on what you mean by a custom header. If you want to alter the caption area itself then you would want to retemplate/style the PaneHeaderPresenter. If you just want to alter the area within the PaneHeaderPresenter that is used to display the header of the ContentPane then you can provide a custom HeaderTemplate.
Hi Andrew,
ContentPane is a HeaderedContentControl, which means I could push any control inside like this:
<Button Content="fff"/>
This construct actually constantly fails with 'already has a logical child' wpf exception while it perfectly works for HeaderedContentControl.
The same happens when I try to set TabHeader. I think you should not force using the HeaderTemplate/TabHeaderTemplate for setting this. It's rather annoying. Why should I provide a data entity + data template when I already have a (working) User Control which represents my header?
Moreover, I think such design violates the meaning of Headered Control and its Header property.
Thanks.
There's two different things here. The error when you set the Header to an element seems like a bug and should be reported to the support group. That being said, I would recommend against putting elements into the Header or TabHeader. A wpf element can only be in 1 part of the visual tree and the Header & TabHeader of the pane are used for several things. The Header is used as the default TabHeader so you would have to set the Header & TabHeader to different objects for every pane you define. The TabHeader will also be used within the various context menus - e.g. the unpinned tray menu and the active files menu. The pane Header can also be used within the pane navigation window so you could well find that the element disappears from the header area and appears in the other area. This is what will happen when you try putting elements into a combobox and then select one of them - it will disappear from the dropdown and appear in the edit area and since the dropdown knows nothing about the move it will not be shown there again even if you select another item.