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.
Good point. I had forgotten that we use the tab related properties for the menu items as well. In that case the best option would be to use the TabHeaderSelector so that you can conditionally return this datatemplate when the container handed to the selector is the PaneTabItem. Alternatively you could try to use a findancestor binding to look for an ancestor menuitem and then hide the close button. e.g.
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
Sorry, it was my mistake.
Everything work.
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 ?
I'm not sure I understand why the datatemplate would behave one way or the other based on the selected state. Can you provide an example that shows that problem? With regards to the alternate approach, basically you would take the Style for the PaneTabItem or the ControlTemplate keyed with either PaneTabItem.DockableTabItemTemplateKey, PaneTabItem.DocumentTabItemTemplateKey and/or PaneTabItem.UnpinnedTabItemTemplateKey and modify the template such that it includes a button similar to that of the datatemplate approach. The xaml files are installed with the product in the DefaultStyles directory.