Silverlight typewriter

You can create some nice text animations with Silverlight 2.0 and with very simple code.  I’ve created a simple typewriter simulator that displays the text character by character.

First, I’ve created a storyboard width a duration of 0.2 seconds and listen to the completed event.  The only other thing that I got in XAML is a <Textblock> element.

In my C# code, I save the text in a variable, clear the textblock and starts the storyboard.  Every time the storyboard is executed, I add a character from the variable to the textblock and starts the storyboard again.

This is a pretty simple example, but you can do very nice stuff with text when using a storyboard as a timer.  Click here to download the sample code.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: