Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Other than the RichTextBox, I haven't found a way to retrieve the XAML for a Control in Silverlight4. Is there a way?

A work-around I've come up with (but haven't yet tested) is to create a XamlElement class that allows you to specify attributes, content, and child elements. Once the control has been constructed in code (and my XamlElement collection has been built), I can call a GetXaml() method that returns all of the xaml for the element (including children attributes, and/or content).

Any ideas? Suggestions?
Posted

1 solution

I don't know if this works for SilverLight but if you don't get any other answers it might be worth your looking.

You can download the sourcecode that accompanies Charles Petzold's book "Applications = Code + Markup" from here[^]. In the code for Chapter 25 there is a 'DumpControlTemplate' project.
 
Share this answer
 
Comments
#realJSOP 4-Apr-11 13:55pm    
I don't really want the entire template. I just want the xaml necessary to display the control. So far, my way is the "best way" (for me).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900