w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Trigger for IsMouseOver on TabItem

If I understand your question correctly, All you have to do is Changing SourceName on Trigger to Border from ContentSite.

Please try the following style:

<Style TargetType="{x:Type TabItem}">
    <Setter Property="Width" Value="160"/>
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Height" Value="70"/>
    <Setter Property="Template">
            <ControlTemplate TargetType="TabItem">
                <Border Name="Border" Background="Transparent">

                    <ContentPresenter x:Name="ContentSite"

                    <Trigger Property="IsSelected" Value="True">
                        <Setter TargetName="Border"
Property="Background" Value="Red" />
                    <Trigger Property="IsSelected" Value="False">
                        <Setter TargetName="Border"
Property="Background" Value="Green" />
                    <Trigger Property="IsMouseOver" Value="True"
                        <Setter TargetName="Border"
Property="Background" Value="Blue" />

And, if you want that to happen only for non selected tabs, you can try the below MultiTrigger

        <Condition Property="IsMouseOver" SourceName="Border"
Value="True" />
        <Condition Property="IsSelected" Value="False" />
    <Setter TargetName="Border" Property="BorderBrush" Value="Blue"

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.