Click here to Skip to main content
15,889,344 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I am trying to get the xaml source of all WPF controls.
I want to understand how can I loop through starting from the Control class and iterating through all the controls and read the xaml of all the controls. My screen design is that on left side I have list of all the controls and on the right side I display the xaml of the selected control from the left side. I cannot hardcode the xaml from msdn website. There must be way to read and display xaml of all the controls dynamically via code
Posted
Comments
Christian Amado 2-Apr-14 17:12pm    
using System.Reflection
Shai Vashdi 18-Apr-14 15:22pm    
WPF has a special structure for that called: LogicalTreeHelper.

http://msdn.microsoft.com/en-us/library/system.windows.logicaltreehelper.aspx

Maciej Los 2-May-14 16:10pm    
Sounds like an answer ;)
Shai Vashdi 3-May-14 5:39am    
Yes you are right, but every time that I give an answer that more of "giving directions" rather than "spoon feeding" I get Down-Voted...
Maciej Los 3-May-14 5:45am    
Don't be afraid to post proper answers!

1 solution

WPF has a special structure for that called: LogicalTreeHelper.

http://msdn.microsoft.com/en-us/library/system.windows.logicaltreehelper.aspx[^]
 
Share this answer
 
Comments
Maciej Los 3-May-14 5:45am    
+5!
Matt T Heffron 3-May-14 19:26pm    
+5!

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