How to read XAML file as nodes and attributes?



Hi all,
I have a simple xaml file (test.xaml) with a single message box activity. I wanted to read the xaml file just like a XML file (nodes and attribute). I had tried using XamlServices.Load(stream,parserContext) function but it is throwing exception. Below is the image of text.xaml

Here is screenshot of XAML code.



Thanks for the solution @vvaidya and @Mateus_Cruz .


Dear @vvaidya

thanks for posting your solution. I have a similar problem, in which I get an error when I want to read some attributes along the tree.

Could you please check my case? You can simply run “main” and you will see you will get an error. (43.8 KB)

Kind regards