Constructors and XAML

 



Constructors and XAML

When you write aspects of a Silverlight-based application in code rather than defining that aspect in markup, you can generally assume that if a given element could be defined in XAML with an object element, then you can also create it in code by following the same logic as a XAML parser, first creating the managed code object with its default constructor, and then setting properties as necessary.

However, there are some exceptions to this general rule. In particular, Silverlight 2 does not support defining a ControlTemplate in code.