Reverse Engineering Styles in Avalon Using System.Windows.Serialization.Parser

A key tenet of Avalon is "lookless" controls: a button should simply be the idea of a button, not the actual button -- very Platonic, really.  Now, the platform would not be very useful if all we provided was the idea of a button, so each content control does have a default style.  Here's a nifty Avalon trick for finding out how the default styles were written, which can be very useful if you are looking to understand how to override that style and replace it with your own:


Control t = new System.Windows.Controls.TextBox();
Style s = t.Style;
using (StreamWriter sw = new StreamWriter(@"C:\Styles\TextBoxDefaultStyle.xaml"))
}Note that you could replace TextBox with any Avalon control.