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,
Is that ContentPane style getting applied to your panes? An easy way to check is to add a setter to change the Background color to Red or some other color. If the ContentPanes in the dock manager become red than that means the style is being used. It sounds like the style is not getting used though so it might be where you have the style stored. Where are you keeping that style stored? In the XamDockManager Resources collection?
Hi Rob,
Thanks for your answer. Yes it looks like it is not being used.
It is in a ResourceDictionary at the top level of my application. In other cases works fine. I have some DataTemplates there that work.
I manage to manually search for the Header and then I set the template. That works fine, I just wanted to see if there was something wrong with the template.
It just doesn't inherit the style from WPF. And that is what i really need :(
Thank you!