Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1735
Set TabHeaderTemplate property of ContentPane through styles
posted

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!