private void MainPicture_MouseHover(object sender, EventArgs e)
{
MainPicture.Width += 2;
MainPicture.Height += 2;
}
private void MainPicture_MouseLeave(object sender, EventArgs e)
{
MainPicture.Width -= 2;
MainPicture.Height -= 2;
}
private void MainPicture_MouseHover(object sender, EventArgs e)
{
if (MainPicture.Width > 32 || MainPicture.Height > 32) return;
MainPicture.Width += 2;
MainPicture.Height += 2;
}
private void MainPicture_MouseLeave(object sender, EventArgs e)
{
if (MainPicture.Width < 34 || MainPicture.Height < 34) return;
MainPicture.Width -= 2;
MainPicture.Height -= 2;
}
<EventTrigger RoutedEvent="StackPanel.MouseEnter">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation
AutoReverse="False"
Duration="0:0:1"
From="Blue" To="Red"
AccelerationRatio="1"
Storyboard.TargetProperty="(StackPanel.Background).(SolidColorBrush.Color)"
FillBehavior="HoldEnd">
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="StackPanel.MouseLeave">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation
AutoReverse="False"
Duration="0:0:1"
From="Red" To="Blue"
AccelerationRatio="1"
Storyboard.TargetProperty="(StackPanel.Background).(SolidColorBrush.Color)"
FillBehavior="HoldEnd">
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>