In SL3.0, can you not just use XamlReader.Load ?

Aug 18, 2009 at 9:10 PM

For example, this creates a light blue triangle:

string xamlTriangle = "<Path xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' " +
                      "xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' " +
                      "Data='M0,0 L 100 50 0 100 Z' Fill='LightBlue' Stretch='Fill'/>";

Path path = (Path)System.Windows.Markup.XamlReader.Load(xamlTriangle);

Sep 15, 2011 at 1:04 PM

Yes this seems to work.  You don't need the 'xmlns:x' namespace either, so you can make the string a bit shorter.