Silverlight 1.0 Dynamic XAML Debugging
|
I have spent a little time recently trying to figure out a way to see my current XAML structure for my Silverlight controls. I am doing a lot of dynamic control creation using CreateFromXAML and adding to other controls.
In order to debug it's almost imperative I be able to see my DOM/XAML structure.
I am lucky enough to be on a training course with PluralSite this week and once thing I found out today allowed me to build my dynamic XAML structure!!
|

|
|
By using the tostring() method on any Silverlight object, you will get back its type. So by building a simple recursive routine I was now able to represent my entire XAML in a tree structure.
You can download my utility class here. Include a reference to this JS file in your Html page and then invoke the getXamlTree function passing in a Silverlight Object. This will return the tree in a very crude HTML structure which you can just set to a DIV or similar!
I need to work on the UI some more, but the fact that I can now see my XAML is huge! |