1

I'm reading an xaml file using XamlReader() and it has of course elements and attributes such as:

<setter property="Property1" Value="Value1" />

Are there any methods to locate a specific property and its associated value?

Should I parse the string using string functions?

0

1 Answer 1

2

The MSDN docs show using an XmlReader as input to XamlReader

// Load the button
StringReader stringReader = new StringReader(savedButton);
XmlReader xmlReader = XmlReader.Create(stringReader);
Button readerLoadButton = (Button)XamlReader.Load(xmlReader);

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

You could just use the XmlReader to grab attributes.

http://msdn.microsoft.com/en-us/library/cc189056%28VS.95%29.aspx

You would use XmlNodeType.Attribute in the switch statement shown in the MSDN example, after first noting the node you're in in the XmlNodeType.Element case.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.