By default, the TabGroupPane within the DocumentContentHost shows a common Close (little x) button at the far right, which when clicked closes the currently active ContentPane. How do we change this so the Header within each ContentPanel has the Close button as well?
If this is possible using styles or templates, a detailed example would be much appreciated.
When a ContentPane is within a DocumentContentHost it doesn't show a header so you''re probably referring to the tab item, which is actually an instance of a PaneTabItem. I can think of a couple of options. You can retemplate the PaneTabItem so that it contains a Button whose command is ContentPaneCommands.Close with a CommandTarget of its Pane property. Another approach would be to set the TabHeaderTemplate to a DataTemplate that contains a button with the same command(target) I mentioned for the previous approach.
e.g. The datatemplate could be something like:
Then set the TabHeaderTemplate on the ContentPane to that:
Hi.
This solution did not work well in my application.
If I have 2 tabs "tab1" and "tab2" and I working in "tab1" (it focused now).
If I click on close button of "tab2" (without selecting whole tab) then current active tab will be closed - "tab1".
But I wanted to close "tab2".
If I work on "tab1" and click on close of "tab1" then everything is good - tab1 closed.
How can I fix this wrong behaviour ?
Sorry, it was my mistake.
Everything work.