voila j'ai un style defini pour des tabitem

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
 
 
<Style TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <DockPanel MinWidth="200">
                        <Border x:Name="Border" Style="{StaticResource TabItemBorder}">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                    <GradientStop Color="#FF545454" Offset="0" />
                                    <GradientStop Color="#FF1C1C1C" Offset="1" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <ContentPresenter>
                                <ContentPresenter.Content>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Label Content="{Binding Path=DisplayName}" Foreground="White" HorizontalAlignment="Left" Grid.Row="1" FontSize="10" />
                                        <Label Content="{Binding Path=HeaderName}" Foreground="White" HorizontalAlignment="Left" Grid.Row="0" FontSize="10" FontWeight="Bold" />
                                    </Grid>
                                </ContentPresenter.Content>
                            </ContentPresenter>
                        </Border>
                    </DockPanel>
                    <!--*****************************************************************************************-->
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                                <Condition Property="IsSelected" Value="False" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFff0000"/>
                                            <SplineColorKeyFrame KeyTime="00:00:01" Value="#FF0000ff"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFffffff"/>
                                            <SplineColorKeyFrame KeyTime="00:00:01" Value="#FF0000ff"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:01" Value="#FFff0000"/>
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF00ff00"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:01" Value="#FFffffff"/>
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                            <!--<Setter Property="Background" Value="#FF0000ff" TargetName="Border" />-->
                        </MultiTrigger>
 
                        <Trigger Property="IsSelected" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFff0000"/>
                                            <SplineColorKeyFrame KeyTime="00:00:01" Value="#FF00ff00"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFffffff"/>
                                            <SplineColorKeyFrame KeyTime="00:00:01" Value="#FF000000"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>                                
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:01" Value="#FFff0000"/>
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF00ff00"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:01" Value="#FFffffff"/>
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
 
 
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
le but du jeux est d'avoir
plusieurs Brush (que je nommerais A, B C) qui sont animées
A = couleur normal
B = couleur selectionné
C = couleur du mouse over

quand l'onglet est sélectionné on passe de A a B
quand l'onglet est deselectionné on passe de B a A
si la souris est sur un onglet deselectionné on passe de A a C
si la souris n'est plus sur l'onglet deselectionné on passe de C a A
si la souris est sur un onglet sélectionné on reste sur B

maintenant j'ai le sentiments que les triggers se mordent la queue !!!