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.
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?
Ok so I've taken the original template along with the change discussed to hide it from the menu and added another trigger that would hide it from the tab item unless it was selected. These are handled in the triggers and are each commented so it is easy to modify/remove triggers.
<DataTemplate x:Key="tabItemHeaderWithClose"> <DockPanel x:Name="pnl"> <Button x:Name="closeBtn" DockPanel.Dock="Right" Visibility="Collapsed" Margin="3,3,0,3" Command="{x:Static igDock:ContentPaneCommands.Close}" CommandTarget="{Binding Path=Pane,RelativeSource={RelativeSource AncestorType={x:Type igDock:PaneTabItem}}}" Style="{DynamicResource {x:Static igDock:TabGroupPane.DocumentCloseButtonStyleKey}}" /> <TextBlock Text="{Binding}" /> </DockPanel> <DataTemplate.Triggers> <!-- To only show it for things in the DocumentContentHost: --> <Trigger Property="igDock:XamDockManager.PaneLocation" Value="Document"> <Setter TargetName="closeBtn" Property="Visibility" Value="Visible" /> </Trigger> <!-- To hide it from the menu items in the TabGroupPane's Files List menu: --> <DataTrigger Binding="{Binding Path=Role, RelativeSource={RelativeSource AncestorType={x:Type MenuItem}}}" Value="SubmenuItem"> <Setter TargetName="closeBtn" Property="Visibility" Value="Collapsed" /> </DataTrigger> <!-- To only show it when the tab item is selected: --> <DataTrigger Binding="{Binding Path=IsSelected, FallbackValue=true, RelativeSource={RelativeSource AncestorType={x:Type igDock:PaneTabItem}}}" Value="False"> <Setter TargetName="closeBtn" Property="Visibility" Value="Collapsed" /> </DataTrigger> </DataTemplate.Triggers> </DataTemplate>
Thanks Andrew for the help. It worked.
How should i modify the DateTemplate provided so that only the selected TabItem has the close button?
D'OH! Never mind - found it. I just had a bad case of pastinginthewrongplacitis.