Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hy!
 
I will be very happy if anyone can tell me how can i make this code to work reverse on the second click. The rectangle resize to small, and i want on the second click that this little rectangle grow back. Thanks in advance.
 
<Window x:Class="asgsag.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Rectangle Name="Rect" Width="150" Height="250"
              Fill="Transparent" 
              HorizontalAlignment="Left" Margin="0,22,0,12" Stroke="Black">
            <Rectangle.Triggers>
                <EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetProperty="Width"
                                   From="150"
                                   To="50"
                                   Duration="0:0:5"/>
                                <DoubleAnimation Storyboard.TargetProperty="Height"
                                   From="250"
                                   To="50"
                                   Duration="0:0:5"
                                   />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Rectangle.Triggers>
        </Rectangle>
    </Grid>
</Window>
Posted 28-Aug-12 8:45am
boco10630

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
boco10 at 28-Aug-12 15:41pm
   
Thanks, but i've found lots of sample aswell but,i just want the simpliest way to do it in xaml. If not necessery i dont want to write code behind. Problem is i have one event trigger, not like mouse enter and mouse leave which is two.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 CPallini 385
1 BillWoodruff 344
2 George Jonsson 295
3 Sergey Alexandrovich Kryukov 293
4 OriginalGriff 222
0 OriginalGriff 5,095
1 CPallini 4,285
2 Sergey Alexandrovich Kryukov 3,767
3 George Jonsson 2,941
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 28 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100