The Silverlight Toolkit was what was previously named the Silverlight Control Pack in the press release when the runtime was released.
This toolkit provides a set of controls and themes for Silverlight 2. In this initial release, they are:
- Themes (6): ExpressionDark/Light, RanierOrange/Purple, ShinyBlue/Red
These controls are released as an initial version, with tests and available with Ms-Pl licensing on Codeplex. Of particular interest to me is the Charting components. Typically available at cost with other platforms, the Silverlight team is providing a base set of Charting controls with source for you to implement, customize and ship with your products. What is great about this type of control is an implementation with data binding as well, especially with an ObservableCollection. With this combination you can have a powerful real-time experience updating information without having to re-paint the entire chart or do any postbacks for the app as well.
Let’s take a quick simple sample of what I’m talking about. To use any of the controls in the toolkit, simply add a reference to the assembly in your project and then use the xmlns declaration at the root of your implementation. I’m going to use “toolkit” as mine like this:
Then we can use the chart in our XAML along with some other code. Here I have a Slider and a TextBlock as well showing the value of the Slider as you change it. I’ve also added the chart series and provided some data binding syntax for the series data:
Now in my code I’ve hacked together some simulation of the ObservableCollection changing the value of the Line data to the value of the slider. Because I implemented my class of Sale with INotifyPropertyChanged the default databinding of OneWay enables my target to be updated once any of my source (salesData) changes. Here’s the full code:
And here is the SalesData.cs class:
The result of which is when I move the slider to perhaps simulate real-time data, I see the data binding change in the chart represented here:
As you can see I have two charts using the same ObservableCollection<T>, so changing the data, changes both of the charts without any extra effort.
Charting along with some of the other controls brings this really, really nice addition to Silverlight 2. I hope you find them valuable. We’ll be using them in projects and digging deeper (especially in charting) on the Silverlight Community Site, so I hope you visit there. You can download the actual sample project for this file as well right here: SLToolkitDemo.zip
If you liked this post, please consider subscribing to the feed for more like it. Justin Angel is also a program manager for the toolkit that you should check out some depth posts from him on the controls as well. You can visit the samples site here showing you a gallery of the controls in implementation.