WPF vs. Silverlight - Part 2 - XamlReader

See intro blogpost here.

XamlReader has different overloads in WPF and Silverlight. Silverlight takes a string. WPF takes a stream to a string.

    UIElement element;
#if SILVERLIGHT
    element = XamlReader.Load(xaml);
#else
    using (MemoryStream xamlStream = 
        new MemoryStream(UTF8Encoding.Default.GetBytes(xaml)))
        element = XamlReader.Load(xamlStream);
#endif

Next: WPF vs. Silverlight - Part 3 - Creating Bitmaps Programmatically

Pingbacks and trackbacks (1)+

Add comment