The Node Loop

Performing a transformation from one format to another involves reading XAML nodes from an appropriate reader and sending them to an appropriate writer. XamlReader and XamlWriter are designed to make this easy, enabling you to write a simple “node loop” that performs the necessary reading and writing from beginning to end. With a XAML reader called reader and a XAML writer called writer, here is what a simple node loop looks like:

// Simple node loopwhile (reader.Read()){  writer.WriteNode(reader);}

What actually happens in this loop depends on the type of the reader and writer. The XAMLPAD sample accompanying this book has the goal of reading XAML in XAML format (stored in a string) and producing a live object graph that can be ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.