bonjour à tous,
voila je debute avec wpf et je voudrais créer une interface jolie avec une petite annimation.
mon interface est composée d'un menu horizontale (tout comme ce site) et lorsque je click sur chacun des bouttons une animation permet de faire descendre un canvas caché(opacité=0).
je me suis inspiré d'une application sur internet http://gallery.expression.microsoft....rlighttemplate.

voici comment j'appel le style pr un boutton
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
<Button x:Name="PcBtn" Style="{StaticResource navButtonPc}" FontSize="14" 
    Content="       Pc" Opacity="100" Canvas.Left="0" Canvas.Top="2"/>

voici le style du boutton
Code XML : 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<Style x:Key="navButtonPc" TargetType="Button">
<Setter Property="FontSize" Value="16"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Template">
  <Setter.Value>
    <ControlTemplate TargetType="Button">
      <Canvas x:Name="NAV">
        <VisualStateManager.VisualStateGroups>
          <VisualStateGroup x:Name="CommonStates">
            <VisualStateGroup.Transitions>
              <VisualTransition To="Pressed"  GeneratedDuration="0:0:0.01"/>
 
            </VisualStateGroup.Transitions>
            <VisualState x:Name="Normal">                                    
            </VisualState>
            <VisualState x:Name="MouseOver">
            <Storyboard x:Name="ripple">
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Opacity)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.75"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="0"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1.292"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="1.646"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1.292"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="1.646"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="-0.042"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="-0.021"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="0.25"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image1" Storyboard.TargetProperty="(UIElement.Opacity)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.75"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="0"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1.308"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="1.616"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1.308"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="1.616"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.269"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="0.538"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.1000000" Value="1"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="-5.494"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="1.006"/>
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
            </VisualState>
            <VisualState x:Name="Pressed">
 
            </VisualState>                                   
            <VisualState x:Name="Disabled">                                       
            </VisualState>
          </VisualStateGroup>
          <VisualStateGroup x:Name="FocusStates">
            <VisualState x:Name="Focused">
              <Storyboard x:Name="Pc1">
 
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imageSo" Storyboard.TargetProperty="(UIElement.Opacity)">
                  <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                  <EasingDoubleKeyFrame KeyTime="00:00:00.0300000" Value="0"/>
                  <EasingDoubleKeyFrame KeyTime="00:00:00.3650000" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                      <ExponentialEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                  </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imageSo" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                  <EasingDoubleKeyFrame KeyTime="00:00:00" Value="4"/>
                  <EasingDoubleKeyFrame KeyTime="00:00:00.0300000" Value="4"/>
                  <EasingDoubleKeyFrame KeyTime="00:00:00.3650000" Value="100">
                    <EasingDoubleKeyFrame.EasingFunction>
                      <ExponentialEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                  </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Pc" Storyboard.TargetProperty="(UIElement.Opacity)">
                  <EasingDoubleKeyFrame KeyTime="00:00:00.3700000" Value="0"/>
                  <EasingDoubleKeyFrame KeyTime="00:00:00.5670000" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                      <ExponentialEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                  </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Pc" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                  <EasingDoubleKeyFrame KeyTime="00:00:00.3700000" Value="0"/>
                  <EasingDoubleKeyFrame KeyTime="00:00:00.5670000" Value="41">
                    <EasingDoubleKeyFrame.EasingFunction>
                      <ExponentialEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                  </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
 
              </Storyboard>
 
            </VisualState>
          <VisualState x:Name="Unfocused">
              <Storyboard>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Pc" Storyboard.TargetProperty="(UIElement.Opacity)">
                  <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="imageSo" Storyboard.TargetProperty="(UIElement.Opacity)">
                  <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
              </Storyboard>
            </VisualState>
          </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
 
 
        <Image x:Name="imageSo" Height="390" Width="868" Canvas.Left="-54" Canvas.Top="3" Source="big_Images/Layer 2.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" Opacity="0">
          <Image.RenderTransform>
            <TransformGroup>
              <ScaleTransform/>
              <SkewTransform/>
              <RotateTransform/>
              <TranslateTransform/>
            </TransformGroup>
          </Image.RenderTransform>
        </Image>
        <Canvas x:Name="Pc" Height="290" Width="844" Canvas.Left="-30" Canvas.Top="160" RenderTransformOrigin="0.5,0.5" Opacity="0"  >
          <Canvas.RenderTransform>
            <TransformGroup>
              <ScaleTransform/>
              <SkewTransform/>
              <RotateTransform/>
              <TranslateTransform/>
            </TransformGroup>
          </Canvas.RenderTransform>
          <Rectangle Stroke="Black" RadiusX="24" RadiusY="24" Height="286" Width="569" Canvas.Left="272" >
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Black" Offset="0"/>
                <GradientStop Color="#FF770DBD" Offset="1"/>
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
 
          <Path Height="164.833" Width="566.5" UseLayoutRounding="False" Canvas.Left="273.167" Canvas.Top="26.167" Data="M0.1013311,164.83301 C0.1013311,164.83301 272.74527,8.1863184 566.49969,49.333008 C566.49969,41.30402 566.49967,0.33300781 566.49967,0.33300781 L2.4835176E-09,1.4996744 z">
            <Path.Fill>
              <LinearGradientBrush EndPoint="0.44,1.029" StartPoint="0.386,-0.172">
                <GradientStop Offset="0"/>
                <GradientStop Color="#6CFFFFFF" Offset="1"/>
              </LinearGradientBrush>
            </Path.Fill>
          </Path>
          <TextBlock x:Name="aboutContent4" Canvas.Left="526" Canvas.Top="102" Foreground="White" TextWrapping="Wrap"><Run Text="Lorem ipsum dolor sit amet, consectetur adipisicing "/><LineBreak/><Run Text="elit, sed do eiusmod "/><Run Foreground="White" Text="tempor "/><Run Text="incididunt ut labore et "/><LineBreak/><Run Text="dolore magna "/><Run Text="aliqua. Ut enim ad minim veniam, "/><LineBreak/><Run Text="quis nostrud exercitation ullamco laboris nisi."/></TextBlock>
          <TextBlock x:Name="servicesTitle1" Canvas.Left="526" Canvas.Top="72" FontSize="16" FontWeight="Bold" Foreground="White" Text="pc" TextWrapping="Wrap"/>
          <TextBlock x:Name="aboutContent5" Canvas.Left="529" Canvas.Top="188" Foreground="White" TextWrapping="Wrap" Width="273"><Run Text="Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque "/><LineBreak/><Run Text="laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi "/><LineBreak/><Run Text="architecto beatae vitae dicta sunt explicabo. "/></TextBlock>
 
          <TextBlock x:Name="staffTitle2" Canvas.Left="14" Canvas.Top="72" FontSize="16" FontWeight="Bold" Foreground="White" TextWrapping="Wrap" Text="Web Solutions?"/>
          <StackPanel x:Name="StaffPanel2" Width="234" Canvas.Left="15" Canvas.Top="102">
            <TextBlock x:Name="intro2" HorizontalAlignment="Left" Text="Here is some information about our Solutions." TextWrapping="Wrap" Foreground="White" Margin="0,0,0,14"/>
 
          </StackPanel>
        </Canvas>
 
 
 
 
 
        <ContentPresenter x:Name="contentPresenter" RenderTransformOrigin="0.5,0.5" OpacityMask="Black">
          <ContentPresenter.RenderTransform>
            <TransformGroup>
              <ScaleTransform/>
              <SkewTransform/>
              <RotateTransform/>
              <TranslateTransform/>
            </TransformGroup>
          </ContentPresenter.RenderTransform>
        </ContentPresenter>
        <Rectangle Fill="#FF4B4B4B" RadiusX="24" RadiusY="24" Height="37" Width="1" Canvas.Left="80" Canvas.Top="-7"/>
        <Image x:Name="image1" Height="13" Width="44" Canvas.Left="12" Canvas.Top="4" Source="ripple_Images/Layer 1.png" Stretch="Fill" Opacity="0" RenderTransformOrigin="0.5,0.5">
          <Image.RenderTransform>
            <TransformGroup>
              <ScaleTransform/>
              <SkewTransform/>
              <RotateTransform/>
              <TranslateTransform/>
            </TransformGroup>
          </Image.RenderTransform>
        </Image>
        <Image x:Name="image" Height="24" Width="82" Source="ripple_Images/Layer 1.png" Stretch="Fill" Canvas.Left="-8" Canvas.Top="-1" Opacity="0" RenderTransformOrigin="0.5,0.5">
          <Image.RenderTransform>
            <TransformGroup>
              <ScaleTransform/>
              <SkewTransform/>
              <RotateTransform/>
              <TranslateTransform/>
            </TransformGroup>
          </Image.RenderTransform>
        </Image>
      </Canvas>
 
    </ControlTemplate>
 
  </Setter.Value>
 
            </Setter>
        </Style>

le probleme que j'ai est que le mouse over et le focused s'applique sur toute la surface cachée (le canvas "Pc" et l'image "ImageSo" qui sont appelés dans le VisualState x:Name="focused" ) et non pas juste sur le boutton en lui meme.
voila je sais pas si j'ai bien expliqué mon probleme.

merci de votre aide