Changing the margin of a WPF Grid using animation

Here's my XAML, so far when someone enter any image in my Window, the animation pops up correctly.

<Style.Triggers>
    <EventTrigger RoutedEvent="Image.MouseEnter">
        <BeginStoryboard>
            <Storyboard>
                <DoubleAnimation Duration="0:0:0.25" From="1" To="1.2" AutoReverse="True"
                            Storyboard.TargetProperty="RenderTransform.ScaleX"/>
                <DoubleAnimation Duration="0:0:0.1" From="1" To="1.2" AutoReverse="True" 
                            Storyboard.TargetProperty="RenderTransform.ScaleY"/>
            </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</Style.Triggers>

Now I'd like to create another storyboard, one that fires on Image.MouseDown, however this time the animation should change the margin of a Grid called x:Name="container".

Can I access other controls properties inside a trigger? If so, how?

Answers


I can think of 2 options here:

  1. Create an EventTrigger for your Grid and set its SourceName property to Image name that fires MouseDown or it`s parent;
  2. Add another EventTrigger directly to the Image and set Storyboard.TargetName for animation to Grid`s name.

Need Your Help

linq to entities orderby

c# .net entity-framework linq-to-entities

How can I convert this query to linq to entities with entity framework:

“Too much recursion” error when using intanceof over typeof?

asp.net javascript recursion loops scriptmanager

I was making a function to convert all dates in an object to strings and when I used the following function I got a error in FF "too much recursion". (It also fails in IE and chrome)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.