added samples
[windows-sources.git] / sdk / samples / WPFSamples / timingbehaviors / csharp / databoundslideranimationexample.xaml
blob8f2f770efab291da612a2197367322c5d3816ecf
2 <Page 
3   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
4   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5   x:Class="Microsoft.Samples.Animation.TimingBehaviors.DataboundSliderAnimationExample" 
6   Background="Cornsilk">
8   <Page.Triggers>
9     <EventTrigger RoutedEvent="Button.Click"  SourceName="myButton">
10       <EventTrigger.Actions>
11         <BeginStoryboard >
13           <Storyboard FillBehavior="HoldEnd" >
14             <DoubleAnimation 
15               FillBehavior="HoldEnd" 
16               BeginTime="00:00:00" 
17               Storyboard.TargetName="MyAnimatedRectangle" 
18               Storyboard.TargetProperty="Width" 
19               Duration="00:00:03"
20               To="{Binding ElementName=AnimationDestinationValueSlider, Path=Value}"
21               From="0">
22             </DoubleAnimation>
23           </Storyboard>
24         </BeginStoryboard >
25       </EventTrigger.Actions>
26     </EventTrigger>
27   </Page.Triggers>
29     
30   <StackPanel Margin="20">
31     
32     <TextBlock>Select a destination value:</TextBlock>
33     <Slider  Name="AnimationDestinationValueSlider"  
34       Orientation="Horizontal"
35       HorizontalAlignment="Left"
36       Minimum="25" Maximum="500" 
37       Width="500" /> 
38     <Rectangle 
39       Width="{Binding ElementName=AnimationDestinationValueSlider, Path=Value}"
40       Height="50" Fill="Red"  
41       HorizontalAlignment="Left" Margin="0,10,0,0" />
42     
43     <TextBlock Margin="0,30,0,0">Animated Rectangle</TextBlock>
44     <Rectangle Width="50" Height="50" Fill="Red" Name="MyAnimatedRectangle"
45       HorizontalAlignment="Left"
46       Margin="0,10,0,0" />
47     <Button Content="Trigger animation" Width="150" Height="40" Name="myButton"/>
48   </StackPanel>
49 </Page>