Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After much research I discovered that the best way to animate this set of images was using a StackPanel and a regular Storyboard. It is much easier to animate the attached properties of a Stackpanel than it is for a Grid. </p> <p><a href="http://msdn.microsoft.com/en-us/library/ms749011.aspx" rel="nofollow noreferrer">More information on attached properties</a> </p> <p><a href="https://stackoverflow.com/questions/1083449/wpf-credits-effect-problem-storyboard-to-animate-a-stackpanel-that-extends-the">This page</a> really helped me to accomplish what I wanted. The system.windows.uielement page at MSDN helped me understand which properties could be changed to manipulate the Stackpanel. </p> <p>My code is now working. I hope this helps.</p> <p>Here is my XAML:</p> <pre><code>&lt;Window.Resources&gt; &lt;Storyboard x:Key="SwipeRight"&gt; &lt;DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="StackPanel1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"&gt; &lt;SplineDoubleKeyFrame KeyTime="00:00:02" Value="-800"/&gt; &lt;/DoubleAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;Storyboard x:Key="SwipeLeft"&gt; &lt;DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="StackPanel1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"&gt; &lt;SplineDoubleKeyFrame KeyTime="00:00:02" Value="+400"/&gt; &lt;/DoubleAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/Window.Resources&gt; &lt;Grid x:Name="LayoutRoot"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="1024" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;StackPanel Name="StackPanel1" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5"&gt; &lt;StackPanel.RenderTransform&gt; &lt;TransformGroup&gt; &lt;ScaleTransform ScaleX="1" ScaleY="1"/&gt; &lt;SkewTransform AngleX="0" AngleY="0"/&gt; &lt;RotateTransform Angle="0"/&gt; &lt;TranslateTransform X="0" Y="0"/&gt; &lt;/TransformGroup&gt; &lt;/StackPanel.RenderTransform&gt; &lt;Image Margin="0,50,0,0" Source="{Binding NextPicture}" x:Name="title" Height="150" VerticalAlignment="Top" Stretch="Uniform"&gt;&lt;/Image&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload