The Silverlight Toolkit is Microsoft's effort to advance the control set for Silverlight developers. In its initial release the Silverlight Toolkit includes 12 controls. Even though the Microsoft-supplied controls for Silverlight now includes most, if not all, of the basic controls needed for typical Silverlight development, Scott Guthrie, Corporate Vice-President in for Microsoft's .NET Developer Division, has indicated that ultimately Microsoft expects to ship another 60+ controls for Silverlight.

The Silverlight Toolkit was posted on CodePlex on October 28, 2008. As we discuss below, this new delivery model represents a significant change in the way that Microsoft creates software for developers.

Categories of Controls
The controls included in the Silverlight Toolkit are organized into four separate categories:

  • Common (includes, for example, the AutoCompleteBox, DockPanel and WrapPanel)
  • Input (includes the NumericUpDown)
  • DataVisualization (includes all of the Charting controls)
  • Layout & Media (does not contain any controls in the first release but apparently some are currently under development)

By default, the Toolkit source code and samples use the XAML namespace prefix of "controls" for controls in the Common category. Those in the Input category use a namespace prefix of "input". Controls in the DataVisualization assembly use the prefix "charting".

Figure 1. This screenshot shows the XAML namespace conventions suggested by Microsoft for controls present in the Silverlight Toolkit.

Silverlight Controls Delivery Model
Microsoft has established four "Quality Bands" which represent the development state of the tools present in the Silverlight Toolkit. These bands consist of:

  • Experimental (exposed for developer feedback and testing)
  • Preview (roughly equivalent to alpha)
  • Stable (beta)
  • Mature (release)

You can get the latest on the status of the controls and quality bands at the Silverlight Toolkit homepage on CodePlex.

Microsoft has announced that it plans a series of iterative releases which are targeted for 6 - 8 week cycles. Each new release will be posted on CodePlex. Individual controls after feedback and improvement are expected to make their way through the quality bands, eventually arriving at the Mature level. At that point, these controls may be added to the collection which is issued with the Silverlight 2 SDK or Silverlight Tools for Visual Studio® 2008. Some may also eventually make it into the Core Runtime. This follows the pattern set by the Beta 2 release of Silverlight which moved a number of frequently used controls into the Core Runtime in order to minimize the size of application downloads.

As part of Microsoft's movement toward more open development, the Silverlight Toolkit includes full source code for all of its controls, unit tests and samples. All source code is available under the Microsoft Public License.

This new development structure presents advantages both to Microsoft and to Silverlight developers. Microsoft anticipates that this structure will result in earlier and more extensive feedback from developers who test and use these controls prior to their achieving Mature status. Developers, on the other hand, because of the availability of source code and unit tests for these controls are in a position to better understand their workings and APIs. This will enable them to both report bugs and in many instances to suggest fixes for bugs. Developers are also better positioned to suggest or add features to these controls which can then make their way into the released version of the controls. It is also hoped that the involvement and contributions of developers to this process will result in a reduction of the time required for the development process of these controls.

To illustrate the content of the Silverlight Toolkit, we have selected what we consider to be three of the most interesting controls for closer examination (TreeView, Charting and the AutoCompleteBox). Later we will also look at Theming.

TreeView Control
Of all the controls in the Silverlight Toolkit, Microsoft's Shawn Burke says the one that received the most developer requests was the TreeView. The Silverlight TreeView is quite similar to its Windows® Presentation Format (WPF) equivalent, including support for data binding and the HierarchicalDataTemplate class. One of the features that WPF's TreeView supports, but Silverlight's currently does not, is UI virtualization. However, you can get some of the benefits of virtualization by handling the TreeViewItem's Expanded and Collapsed events.

Figure 2. Sample screenshot of a restyled Silverlight TreeView (names from the Northwind database, photos from Microsoft Office Online Clip Art).

The basic idea behind virtualization is to create only just enough visual elements to display the data that the user is currently viewing. A large hierarchical data collection could contain tens of thousands of items. If your code tried to immediately create visual elements for all of them at once, performance may suffer. But initially you only really need to create just a screenful of visual elements for the highest level of the TreeView. As the user drills down into the TreeView by expanding its nodes, your code can handle those Expanded events. In that event handler you would create just enough new visual elements to display the top level of the newly revealed branch. For sample code to implement this, see this thorough tutorial by Justin Angel.

  Next Page: Charting