Dodsworth
asked on
XAML Reader
Is there a way to programmatically access the XAML text of the currently running page in .net?
ASKER
I need to access it from code behind.
I don't know of a way, other than System.Windows.Markup.Xaml Reader.
May I ask what your use case is for reading the XAML?
May I ask what your use case is for reading the XAML?
Hi Dodsworth;
When the project using XAML such as WPF and Silverlight the XAML gets compiled and becomes a BAML, Binary Application Markup Language. This is done so that the application does not get slowed down when running the code to compile it. So the simple answer is no. But XAML represents user defined controls and these controls if given a x:Name can be accessed through code.
I hope that helps.
When the project using XAML such as WPF and Silverlight the XAML gets compiled and becomes a BAML, Binary Application Markup Language. This is done so that the application does not get slowed down when running the code to compile it. So the simple answer is no. But XAML represents user defined controls and these controls if given a x:Name can be accessed through code.
I hope that helps.
What in particular are you trying to get at from the code-behind?
ASKER
I'd like to get the complete PhoneApplicationPage XAML.
ASKER
OK so I have found a means to read the XAML, but with one problem... I can only view the compiled XAML.
My requirement is to read the current 'running' XAML, after elements have been added to the page in code behind. Don't know how or where this is managed :(
My requirement is to read the current 'running' XAML, after elements have been added to the page in code behind. Don't know how or where this is managed :(
There is no XAML for elements that are added in code-behind.
The definition of an element in XAML has the same effect as the creation of an element in code-behind and adding it as a child of some existing element: they both add the element to the Visual Tree.
Are you trying to examine the current content?
The definition of an element in XAML has the same effect as the creation of an element in code-behind and adding it as a child of some existing element: they both add the element to the Visual Tree.
Are you trying to examine the current content?
ASKER
Yes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
XAML Spy
http://xamlspy.com/