Migrate style from TabItem to TabHeader

Posted by OffApps Cory on Stack Overflow See other posts from Stack Overflow or by OffApps Cory
Published on 2010-05-11T17:20:10Z Indexed on 2010/05/11 17:24 UTC
Read the original article Hit count: 315

Filed under:
|
|
|

Good day!

I have a TabControl with TabItems that have been customized via a control template. This control template specifies a trigger whereby on mouseover, the content of tab header grows slightly.

<ControlTemplate>
    <Storyboard x:Key="TabHeaderGrow">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="TabName" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
            <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1.1"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="TabName" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
            <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1.1"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
<ControlTemplate.Triggers>
    <EventTrigger RoutedEvent="Mouse.MouseEnter">
        <BeginStoryboard Storyboard="{StaticResource TabHeaderGrow}"/>
    </EventTrigger>

When I mouseover any of the tabs they work as expected, however the trigger also fires when I mouseover any of the elements in the tab body. I know that I need to migrate the control styling to a tabHeader controlTemplate, but I am unsure how to do that. I can't seem to do template binding for the content of the tabheader. Any help would be appreciated.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about controltemplate