Summary
This post describes controls in Silverlight 2, Silverlight 2 SDK, and Silverlight Toolkit December 2008 Release, and their designer support. Based on their shipping vehicles, there are three types of Silverlight controls from Microsoft: runtime controls, SDK controls, and Toolkit controls. Designer support for runtime and SDK controls are spread over Visual Studio, Blend, and Silverlight SDK; while designer support for Toolkit controls are fully implemented by design assemblies in the Toolkit, using designers' extensibility framework.
Runtime Controls
Silverlight runtime comes with a set of basic controls, like Button, Canvas, Ellipse, and TextBox. It also exposes some base classes like Control, UserControl and Panel, to allow users to customize, extend and build their own controls. All run time controls are in System.Windows.dll under %ProgramFiles%\Microsoft Silverlight\2.0.31005.0\:
Please note the XmlnsDefinition attributes above. Runtime controls live in the default xmlns http://schemas.microsoft.com/winfx/2006/xaml/presentation, so their tags don't need any xmlns prefix, as shown in below xaml:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MySLApp1.Page"
Width="640" Height="480">
<StackPanel x:Name="LayoutRoot" Background="White">
<Button x:Name="Button" />
</StackPanel>
</UserControl>
SDK Controls
Silverlight 2 SDK is a separate package from Silverlight runtime. You can install it from http://silverlight.net/GetStarted:
It is part of the Silverlight Tools for Visual Studio 2008 SP1 download, which also includes Silverlight 2 developer runtime. Silverlight 2 SDK adds two control dlls: System.Windows.Controls.dll and System.Windows.Controls.Data.dll.
System.Windows.Controls.dll
System.Windows.Controls assembly adds four main controls: Calendar, DatePicker, GridSplitter, TabControl, and their supporting classes, to the same two CLR namespaces: System.Windows.Controls & System.Windows.Controls.Primitives, in which most runtime controls also live. All controls in System.Windows.Controls assembly are in the xmlns "clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls", and usually use the "basics" xmlns prefix, as shown in below Xaml:
<UserControl
xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
x:Class="MySLApp1.Page"
Width="640" Height="480">
<StackPanel x:Name="LayoutRoot" Background="White">
<basics:Calendar></basics:Calendar>
</StackPanel>
</UserControl>
System.Windows.Controls.Data.dll
System.Windows.Controls.Data assembly adds the all mighty DataGrid control and its supporting classes to the same two CLR namespaces, System.Windows.Controls & System.Windows.Controls.Primitives, just like the runtime assembly System.Windows and the SDK assembly System.Windows.Controls.
System.Windows.Controls.Data controls (just DataGrid for now) are in the xmlns "clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data", and usually use the "data" xmlns prefix, as shown in below Xaml:
<UserControl
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
x:Class="MySLApp1.Page"
Width="640" Height="480">
<StackPanel x:Name="LayoutRoot" Background="White">
<data:DataGrid></data:DataGrid>
</StackPanel>
</UserControl>
Toolkit Controls
Silverlight Toolkit is yet another separate package that you can install from http://silverlight.net/GetStarted:
You can also install it directly from Toolkit's home page: http://www.codeplex.com/Silverlight.
Once installed, the Silverlight Toolkit adds four more control assemblies:
Each assembly introduces a new xmlns prefix and a set of controls under it:
- System.Windows.Controls.dll
- xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls"
- Main controls: AutoCompleteBox, DockPanel, Expander, HeaderedContentControl, HeaderedItemsControls, Label, TreeView, Viewbox, WrapPanel
- System.Windows.Controls.Input.dll
- xmlns:input="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls.Input"
- Main controls: NumericUpDown, ButtonSpinner
- System.Windows.Controls.Theming.dll
- xmlns:theming="clr-namespace:Microsoft.Windows.Controls.Theming;assembly=Microsoft.Windows.Controls.Theming"
- Main controls: ImplicitStyleManager, Theme (concrete Theme classes are implemented in assemblies under Themes directory)
- System.Windows.Controls.DataVisualization.dll
- xmlns:charting="clr-namespace:Microsoft.Windows.Controls.DataVisualization.Charting;assembly=Microsoft.Windows.Controls.DataVisualization"
- Main controls: Chart, [Category|DateTime|Linear]Axis, [Bubble|Bar|Column|Line|Scatter|Pie]Series
Below screenshot shows a Silverlight application using the four Toolkit assemblies:
Designer Support
The two Silverlight designers from Microsoft are Visual Studio 2008 SP1 and Expression Blend 2 SP1. Designer support for Visual Studio 2008 SP1 (VS9) is mostly about toolbox icon and IntelliSense, as shown in above screenshot. Designer support for Blend 2 is mostly about metadata registration, like Description, Category, Browsable, ToolboxBrowsable etc attributes, as shown by below screenshot:
Designer Support for Runtime and SDK Controls
Below screenshots demonstrate designer support for Silverlight runtime and SDK controls:
- Visual Studio has toolbox icons and IntelliSense for runtime and SDK controls:
- Blend has rich support (Icons, Categories, Descriptions, inline/extended/dialog Editors etc) for runtime and SDK controls:
The design time assemblies for runtime and SDK controls are installed by Silverlight SDK:
- System.Windows.VisualStudio.Design.dll for runtime controls in System.Windows.dll
- System.Windows.Controls.Design.dll & System.Windows.Controls.xml for SDK controls in System.Windows.Controls.dll
- System.Windows.Controls.Data.Design.dll & System.Windows.Controls.Data.xml for SDK controls in System.Windows.Controls.Data.dll
If we open those design dlls in reflector, we can see that they don't do much other than providing toolbox icons for Visual Studio:
There is no metadata registration, nor nice icons displayed by Blend. So the rich designer support for runtime and SDK controls in Visual Studio and Blend are actually implemented by the designers themselves, instead of design assemblies for those controls. This creates tight coupling between tools (VS9 and Blend2) and controls (runtime and SDK controls).
Designer Support for Toolkit Controls
On the other hand, designer support for Toolkit controls are fully implemented by design assemblies in Toolkit, built on top of designer extensibility framework:
You can get more information about Toolkit design time features and their implementation from following posts:
- Design Time Features in Silverlight Toolkit
- Design Time Feature Implementation in Silverlight Toolkit
- How to Add a Toolbox Icon for Your Silverlight Control
Conclusion
So we have three vehicles for shipping Silverlight controls:
- The Toolkit is open-source on Codeplex and ships every few months. This enables us to "add new functionality quickly for designers and developers, and provide the community an efficient way to help shape product development by contributing ideas and bug reports."
- For those controls that are well baked, widely adopted and reached mature quality band, we may move them to SDK.
- Over time some of the SDK controls may merge into Silverlight runtime.
Silverlight revolutionizes web development by converging web and desktop development technologies (languages, platforms, tools etc), unifying web and desktop, and bringing the power of desktop to web client. Silverlight Toolkit team is like an agile ISV inside Microsoft, continuously and aggressively enriching and empowering the Silverlight platform, as well as pioneering a new agile, collaborative and open-sourced engineering model. The idea was started by Shawn Burke and Scott Guthrie, as described in Shawn's blog post Control Freak.