.Net / Workflow Foundation / Silverlight Evangelist RSS Feed


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!

 
Posted by Dave Britton | 2 Comments | Trackback Url | Bookmark with:        
Tags:

Links to this Post

Comments

Friday, 14 Sep 2007 09:57 by Re: Silverlight 1.0 Dynamic XAML Debugging
<div class=ExternalClass1272949B46854C0DA27B2D7DA2B177F7><div>If only we could see attributes aswell:-(</div></div>

Monday, 17 Sep 2007 08:12 by Re: Silverlight 1.0 Dynamic XAML Debugging
<div class=ExternalClass54617F6E993D464DA4E4D4B806D8B281><div>Yeah, this was a v1, just to see if I could get anything working, but I intend to add attributes as I continue to build this out.</div> <div> </div> <div>Dave</div></div>

Name:
URL:
Email:
Comments:

CAPTCHA Image Validation