Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Enter and exit actions MouseEnter and MouseLeave, Unloaded

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       HorizontalAlignment="Center" VerticalAlignment="Center">         <Ellipse Fill="Green" Width="20" Height="100">       <Ellipse.Triggers>         <EventTrigger RoutedEvent="Ellipse.MouseEnter">           <BeginStoryboard Name="enterAnim">             <Storyboard>               <DoubleAnimation By="400" Duration="0:0:4"                   Storyboard.TargetProperty="Width" />             </Storyboard>           </BeginStoryboard>         </EventTrigger>         <EventTrigger RoutedEvent="Ellipse.MouseLeave">           <BeginStoryboard HandoffBehavior="Compose" Name="leaveAnim">             <Storyboard>               <DoubleAnimation By="-400" Duration="0:0:4"                   Storyboard.TargetProperty="Width" />             </Storyboard>           </BeginStoryboard>         </EventTrigger>         <EventTrigger RoutedEvent="Ellipse.Unloaded">           <RemoveStoryboard BeginStoryboardName="enterAnim" />           <RemoveStoryboard BeginStoryboardName="leaveAnim" />         </EventTrigger>       </Ellipse.Triggers>     </Ellipse> </Page>