Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: None  |  size: 1.82 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. WPF VisualStateManager Animation Binding
  2. <Grid x:Name="MainInterface">
  3.     <Grid.Resources>
  4.         <Storyboard x:Key="GameToTitle">
  5.             <DoubleAnimation Storyboard.TargetName="GameScreenInterface" Storyboard.TargetProperty="(Control.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)" From="0" To="{Binding Path=ActualHeight, ElementName=MainInterface}" Duration="0:0:0.2"/>
  6.             <DoubleAnimation Storyboard.TargetName="TitleScreenInterface" Storyboard.TargetProperty="(Control.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)" From="{Binding Path=ActualHeight, ElementName=MainInterface, Converter={Converters:InverseConverter}}" To="0" Duration="0:0:0.2"/>
  7.         </Storyboard>
  8.     </Grid.Resources>
  9.     <VisualStateManager.VisualStateGroups>
  10.         <VisualStateGroup>
  11.             <VisualState x:Name="TitleScreenState" Storyboard="{StaticResource ResourceKey=GameToTitle}"/>
  12.             <VisualState x:Name="GameScreenState">
  13.                 <Storyboard>
  14.                     <DoubleAnimation Storyboard.TargetName="GameScreenInterface" Storyboard.TargetProperty="(Control.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)" From="{Binding Path=ActualHeight, ElementName=MainInterface}" To="0" Duration="0:0:0.2"/>
  15.                         <DoubleAnimation Storyboard.TargetName="TitleScreenInterface" Storyboard.TargetProperty="(Control.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)" From="0" To="{Binding Path=ActualHeight, ElementName=MainInterface, Converter={Converters:InverseConverter}}" Duration="0:0:0.2"/>
  16.                 </Storyboard>
  17.             </VisualState>
  18.         </VisualStateGroup>
  19.     </VisualStateManager.VisualStateGroups>
  20.     <View:TitleScreen x:Name="TitleScreenInterface"/>
  21.     <View:GameScreen x:Name="GameScreenInterface" />
  22. </Grid>