I have an application that it is running in WPF and usings NetAdvantage 12.2. The main window structure, header and such, are in a external dll, i add my content inside of it. I dont have access to the way the tabs are being built. I need, however, to change the Header, the user would like to have the close button right next to the title of the tab. I read this and i created that template and I am trying to set it with a Style. I am pretty new in WPF so I may be doing something wrong, although i have checked with other collegues.
I have this code in a Resource Dictionary, but is not working:
<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 igWPF:ContentPaneCommands.Close}"
CommandTarget="{Binding Path=Pane,RelativeSource={RelativeSource AncestorType={x:Type igWPF:PaneTabItem}}}"
Style="{DynamicResource {x:Static igWPF:TabGroupPane.DocumentCloseButtonStyleKey}}" />
<TextBlock Text="{Binding}" />
</DockPanel>
<DataTemplate.Triggers>
<Trigger Property="igWPF:XamDockManager.PaneLocation" Value="Document">
<Setter TargetName="closeBtn" Property="Visibility" Value="Visible" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
But it doesnt work
<Style TargetType="igWPF:ContentPane">
<Setter Property="TabHeaderTemplate" Value="{StaticResource tabItemHeaderWithClose}"/>
</Style>
Any help or tips taht you could give me, will be greatly appreciated.
Thanks!
Hi Viviana,
The ThemeManager operates at a lower level than the App level so it will take priority. I'm glad you got it working though. Let me know if you have any further questions on this matter.
Thanks Rob for your help!
I manage to talk with the people that was developing the component I was using, and they changed it so could work with what you said.We didnt know that the ThemeManager had more priority than the App lvl Resources.
Thank you!
In order to make this work you're going to need to move the ContentPane style down into the XamDockManager.Resources collection. This is how you give your style enough priority over the theme style so it gets used. Once it's moved here it will get used and the TabHeaderTemplate that you set in the style will be used for all content panes.
It looks like that is the issue. I've updated my sample and I can now reproduce the issue you're having. Let me look into this a bit and I'll get back to you.
Thanks for your prompt response again.
I don't have any other styles for the header in the application. We are however using the ThemeManager (ThemeManager.CurrentTheme = ThemeManager.ThemeNameIGTheme). Do you think that could be overriding the style I set for the header? If so, is there a way to have more priority than the ThemeManager Style?