Hi,
I have an XAML document that I have to read from a MemoryStream (for the purpose of the example, I load a XAML file to a memorystream)
Here is a shortened version of the XAML file:
I have to traverse the document and get the "-1" value from the <SystemDecimal> tag
How should I please do...Here is what I've achieved until now..without success:
Thanks for your help or advice!
I have an XAML document that I have to read from a MemoryStream (for the purpose of the example, I load a XAML file to a memorystream)
Here is a shortened version of the XAML file:
VB.NET:
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib" >
<Grid.Resources>
<System:Decimal x:Key="example">-1</System:Decimal>
</Grid.Resources>
</Grid>
I have to traverse the document and get the "-1" value from the <SystemDecimal> tag
How should I please do...Here is what I've achieved until now..without success:
VB.NET:
StreamReader mysr = new StreamReader("example.xaml");
XmlDocument doc = new XmlDocument();
doc.Load(mysr);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("System", "clr-namespace:System;assembly=mscorlib");
XmlNode node = doc.SelectSingleNode("/Grid/Grid.Resources/System:Decimal", nsmgr);
Debug.Print(node.InnerText);
Thanks for your help or advice!
Last edited: