'Animate a Child-Target
*i have some issues to animate a child-target. I've a Grid with two Buttons. If i Enter with the Mouse into the Grid, i want to animate the Buttons with doubleanimation, different than the parent element (Grid). Is this possible?
What I intend to do is for the buttons to have a different animate than the grid when I mouse over the grid Thats my try:*
<Window.Resources>
<Style TargetType="{x:Type Grid}" x:Key="GrowMeUp">
<Style.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation Storyboard.TargetProperty="Margin" From="0" To="5" Duration="0:0:.2"/>
<DoubleAnimation Storyboard.TargetName="Button1" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:.2"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation Storyboard.TargetProperty="Margin" From="5" To="0" Duration="0:0:.2"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid Style="{StaticResource GrowMeUp}">
<StackPanel>
<Button x:Name="btn_FileUpload" Name="Button1" Background="White" Height="50" Width="400" Content="Save"/>
<Button x:Name="btn_FileDownload" Name="Button2" Background="White" Height="50" Width="400" Content="Save"/>
</StackPanel>
</Grid>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
