One of the things I like about Silverlight is the ability to customize existing controls. Just about every control that ships with Silverlight has a default style. You are free to override the default style, create a new style from scratch or if you so choose edit a copy of the default style. Using the new style is as simple as setting the Style attribute Style="{StaticResource StyleName} where StyleName is the name of the style. For further information on styling refer to the following post.
But where can you find the default style for a control?
Excluding third party tools, I know of at least three ways;
1. From the Silverlight Documentation
If you haven't done so then download the offline Silverlight documentation. The default styles for the Silverlight controls are published in this document.
2. Use Blend
The second way is to use blend. All you need to do is select the control and right click and choose Edit Control Parts (Template)->Edit Copy. This will create a copy of the default style and attach it the control.
3. .NET Reflector (Before you begin I realize this is a third party tool, but it's my blog and I use it so much it doesn't feel like one anymore)
The final method is to use everybody's friend, .NET Reflector. Find the assembly for the control. For example, if you are wanting the default style for say a button then add the following assembly to .NET reflector.
C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Reference Assemblies\System.Windows.dll
Next navigate to the Systems.Windows->Resource->System.Windows.g.resources node and double click it. After doing so you .NET Reflector will appear similar to the the following
Next double click the XAML file in the disassembler pane. Provider you have associated the XAML file extension with the VS2008 executable you should see the default styles for all the controls in that assembly, similar to the figure below. Note the default file association for XAML is IE which does not render the XAML correctly.
Which method do I prefer? The first will only work with the documentation and the code are in sync. Both Blend and Reflector will produce styles that are in sync with the code, however, Blend is not free and not every developer will have a copy. Need I say more.
Guess the movie
Seventeen *days?* Hey man, I don't wanna rain on your parade, but we're not gonna last seventeen *hours!* Those things are gonna come in here just like they did before. And they're gonna come in here...