Autor Beitrag
Dr.Prof.Evil
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Mo 02.02.15 17:13 
Hallo erstmal,

ich progge gerade an einem simplen Programm. Dieses tut doch hier nichts zur Sache.

Ich habe in Blend for VS 2013 ein Rectangle erstellt und dieses als neues Steurelement, Button, hinzugefügt.
Darauf habe ich als Ereignis hinzugefügt: grid.MouseLeftButtonDown und eine entsprechende Animation dazu erstellt.
Nun soll aber durch grid.MouseLeftButtonUp eine andere Animation ausgeführt werden, doch wird diese NICHT ausgeführt und ich verstehe nicht warum.

Vllt. hilfreicher, aber vllt. auch unnützer Code
ausblenden volle Höhe XML-Daten
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:
<Style x:Key="NormalButton" TargetType="{x:Type Button}">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type Button}">
            <ControlTemplate.Resources>
              <Storyboard x:Key="OnMouseLeftButtonDown1">
                <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="rectangle">
                  <EasingThicknessKeyFrame KeyTime="0" Value="0"/>
                  <EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="3"/>
                  <EasingThicknessKeyFrame KeyTime="0:0:0.4" Value="0"/>
                </ThicknessAnimationUsingKeyFrames>
              </Storyboard>
              <Storyboard x:Key="OnMouseLeftButtonUp1">
                <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="rectangle">
                  <EasingThicknessKeyFrame KeyTime="0" Value="3"/>
                  <EasingThicknessKeyFrame KeyTime="0:0:0.3" Value="0"/>
                </ThicknessAnimationUsingKeyFrames>
              </Storyboard>
            </ControlTemplate.Resources>
            <Grid x:Name="grid">
              <Rectangle x:Name="rectangle" Fill="White" RadiusY="4" RadiusX="4" Stroke="Black" StrokeThickness="2">
                <Rectangle.Effect>
                  <DropShadowEffect/>
                </Rectangle.Effect>
              </Rectangle>
              <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="0"/>
            </Grid>
            <ControlTemplate.Triggers>
              <EventTrigger RoutedEvent="UIElement.MouseLeftButtonDown" SourceName="grid">
                <BeginStoryboard x:Name="OnMouseLeftButtonDown1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeftButtonDown1}"/>
              </EventTrigger>
              <Trigger Property="IsFocused" Value="True"/>
              <Trigger Property="IsDefaulted" Value="True"/>
              <Trigger Property="IsMouseOver" Value="True"/>
              <Trigger Property="IsPressed" Value="True"/>
              <Trigger Property="IsEnabled" Value="False"/>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>


Kann mir vllt. jmd helfen?

lg
Dr. Prof. Evil