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, I would also like to hide/collapse the delete button on items which is not allowed to close, meaning where the AllowClose parameter is set to False.
I've tried to modify your code with a MultiTrigger, but the close button is still visible on items where AllowClose = False.
<MultiTrigger> <MultiTrigger.Conditions> <Condition Property="igDock:XamDockManager.PaneLocation" Value="Document" /> <Condition Property="igDock:ContentPane.AllowClose" Value="True" /> </MultiTrigger.Conditions> <Setter TargetName="closeBtn" Property="Visibility" Value="Visible" /></MultiTrigger>
Do you have any suggestions?
Very nice Template, it basically works really well!
However, I noticed that the close button is also shown in the files menu. This is not a real problem, but somehow the command target is lost. The following error appears in the output (in VS debug mode):
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Infragistics.Windows.DockManager.PaneTabItem', AncestorLevel='1''. BindingExpression:Path=Pane; DataItem=null; target element is 'Button' (Name='closeBtn'); target property is 'CommandTarget' (type 'IInputElement')
As a effect, the closeButton does not work as intended. Is it possible to alter the template, so that the close button does not appear in the files menu?
Thanks,Patrick
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 ?
Thanks for the DataTemplate solution - that works great. We ended up purchasing Licenses for the WPF suite, and the prompt assistance from Infragistics was definitely a factor.
We have tasks being run in each of these tabs, and the client would like each tab to visually indicate that such a task is running and when its done running the task. To do this, I modified the DataTemplate to include a WPF ProgressBar control, whose state reflects the running task. This works fine when the tab is the active pane, and the ProgressBar displays correctly. However, when you switch to another tab, the ProgressBar goes back to looking empty and is not updated at all. In other words, only the ProgressBar in the header of the active tab displays correctly, and the ProgressBars in all other tabs display empty.
This is of course not useful, as it is the status of inactive tabs that needs to be displayed.
Would you have a fix for this, or an alternate suggestion to display a working ProgressBar or an animated icon in the header of an inactive ContentPane?
Also, could you provide an example of the alternative approach you've mentined, namely "You can retemplate the PaneTabItem so that it contains a Button whose command is ContentPaneCommands.Close with a CommandTarget of its Pane property."?
Best regards, and thanks in advance.