If you look at the code for WinForms, the controls are built and configured in the code.
If you decompile (for example, via Reflector) an assembly created from web .aspx or .ascx into WebForms, this is just code that outputs HTML (many calls to Response.Write via HtmlTextWriter .
XAML is just a way to define a graph of objects.
This is just a code.
There are no reasons why you cannot:
- Create your own custom code generator to generate user interface code at compile time.
- Create the "controls" needed for some DSLs at runtime.
source share