Creating Falling Snow in Silverlight!

Exactly a year ago (plus one day…but who’s counting?!), I posted a sample WPF application that simulates falling snow. Since Silverlight 2 was released since then, below you will find a Silverlight version of a similar falling snow effect:

Get Microsoft Silverlight

Just click on the Let It Snow banner to cause 200 snowflakes to start falling. Feel free to use this for your own projects, and the source files have been provided below:


folderfiles Download Falling Snow Source

For your own projects, the only thing you may want to tweak is the width and height of your application. Currently, everything is hard coded to a width and height of 500px by 300px respectively, but if you decide to change the size, be sure to open Page.xaml.cs and change the dimensions provided:

private void PopulateSnowFlakes() {    for (int i = 0; i < 200; i++)    {       SnowFlake snowFlake = new SnowFlake();       // 500 and 300 is the width/height of the application       snowFlake.SetInitialProperties(500, 300);       LayoutRoot.Children.Add(snowFlake);    } }

Besides that, everything else should be pretty straightforward. If you have any questions, feel free to leave them below.

Cheers!
Kirupa