Reputation: 861
I have variables like this
<Grid Grid.Column="1" x:Name="AdvArea" Margin="10,0,0,0">
<Canvas x:Name="Advertise" Background="{x:Null}" Margin="10,0,0,0" >
<TextBlock Name="AdvMarquee" Text="Scroll Text For Advertise" Padding="10, 0, 10, 0"/>
</Canvas>
</Grid>
I finally applied Marquee with DoubleAnimation on TextBlock with this code.
private void UserControl_Loaded( object sender, RoutedEventArgs e )
{
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.From = -AdvMarquee.ActualHeight;
doubleAnimation.To = 0;
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
doubleAnimation.Duration = new Duration( TimeSpan.FromSeconds(5) );
AdvMarquee.BeginAnimation( Canvas.TopProperty, doubleAnimation );
// Dev Area
List<String> Messages = new List<String>();
Messages.Add( String.Format( "AdvMarquee : HasAnimatedProperties > " + AdvMarquee.HasAnimatedProperties ) );
Messages.Add( String.Format( "doubleAnimation.From : " + doubleAnimation.From ) );
Messages.Add( String.Format( "doubleAnimation.To : " + doubleAnimation.To ) );
Messages.Add( String.Format( "doubleAnimation.RepeatBehavior : " + doubleAnimation.RepeatBehavior ) );
Messages.Add( String.Format( "doubleAnimation.Duration : " + doubleAnimation.Duration ) );
MessageBox.Show( String.Join("\n", Messages ) );
}
What I planned to do was Scroll text from outside of range to screen
and stop a moment for show
after that, scroll from screen to outside.
but I don't know how to apply another animation after exist animation finished.
My Scenario
Scroll down my text from outside of screen to screen
keep this text for a moment ( for example, 10 seconds )
scroll down again from screen to outside of screen.
What I need to know
Apply DoubleAnimation to TextBlock ( Done )
Apply Another DoubleAnimation when First DoubleAnimation Finished.
Any tip is okay so, give me your hands.
thanks.
Upvotes: 0
Views: 37
Reputation: 22956
You need to create a storyboard, which is an object that allows multiple child animations. Use it to animate more than a single property at once and also to chain animations one after another. Start with the following documentation.
Upvotes: 1