Below you will find a very simple example of increasing the height of the button \ width when the button is pressed and compressed when the mouse leaves the control. Animation in WPF is done using StoryBoards. Storyboards are commonly found in EventTriggers and can be stored in management resources, windows, pages, or applications. Below is a sample along with some resources:
<Window x:Class="WPFFeatureSample_Application.AnimationWindowSample" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="AnimationWindowSample" Height="300" Width="300"> <Grid> <Button Content="Sample" Width="50" Height="50"> <Button.Triggers> <EventTrigger RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard> <DoubleAnimation To="200" Storyboard.TargetProperty="Width"></DoubleAnimation> <DoubleAnimation To="200" Storyboard.TargetProperty="Height"></DoubleAnimation> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="MouseLeave"> <BeginStoryboard> <Storyboard> <DoubleAnimation To="50" Storyboard.TargetProperty="Width"></DoubleAnimation> <DoubleAnimation To="50" Storyboard.TargetProperty="Height"></DoubleAnimation> </Storyboard> </BeginStoryboard> </EventTrigger> </Button.Triggers> </Button> </Grid>
Literature:
http://msdn.microsoft.com/en-us/library/ms742868.aspx
http://windowsclient.net/learn/
source share