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
boco10624

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
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,398
1 OriginalGriff 508
2 Manas Bhardwaj 383
3 Damith Weerasinghe 330
4 Tadit Dash 310
0 Sergey Alexandrovich Kryukov 9,575
1 OriginalGriff 6,006
2 Peter Leow 4,500
3 Maciej Los 3,540
4 Abhinav S 3,513


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