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
|
<UserControl x:Class="WpfAnimationBlend.ControlAnimation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfAnimationBlend"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" BorderBrush="#FF001EFF">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<!--binding de la prop Command sur RelayCommand-->
<Button
Content="Animate"
Command="{Binding Cmd}"
Background="#FFE61414"
BorderBrush="#FF3564C9"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<Canvas
Grid.Row="1"
Height="400"
Width="400"
>
<Label x:Name="LabelMatrix"
Content="MyLabel"
Background="Blue"
Canvas.Left="176" Canvas.Top="29.05"
RenderTransformOrigin="0.5,0.5">
<Label.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Label.RenderTransform>
<!--pave à taper-->
<Label.Style>
<Style >
<Style.Triggers>
<!--binding sur prop CLR-->
<DataTrigger Binding="{Binding IsReady}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingPath Duration="0:0:2" Source="X" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" >
<DoubleAnimationUsingPath.PathGeometry>
<PathGeometry Figures="M150.735,159.595 C150.735,244.71589 78.205129,313.72 -11.265,313.72 C-100.73513,313.72 -173.265,244.71589 -173.265,159.595 C-173.265,74.474113 -100.73513,5.47 -11.265,5.47 C78.205129,5.47 150.735,74.474113 150.735,159.595 z"/>
</DoubleAnimationUsingPath.PathGeometry>
</DoubleAnimationUsingPath>
<DoubleAnimationUsingPath Duration="0:0:2" Source="Y" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<DoubleAnimationUsingPath.PathGeometry>
<PathGeometry Figures="M150.735,159.595 C150.735,244.71589 78.205129,313.72 -11.265,313.72 C-100.73513,313.72 -173.265,244.71589 -173.265,159.595 C-173.265,74.474113 -100.73513,5.47 -11.265,5.47 C78.205129,5.47 150.735,74.474113 150.735,159.595 z"/>
</DoubleAnimationUsingPath.PathGeometry>
</DoubleAnimationUsingPath>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
</Canvas>
</Grid>
</UserControl> |
Partager