Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here
Using XXRS and XXR with XR…a how to.

Mike Shim blogged how you should Use XamlReader.Load for WPF XAML (not XamlServices.Load).

I just saw a twitter comment asking how to XamlXmlReaderSettings with XamlReader.

I believe we ended up enabling in .NET 4, the ability to use System.Xaml.dll with WPF with a few special exposed APIs:

//If you want to set any special settings (like local assembly, you can set those settings here)
XamlXmlReaderSettings xxrs = new XamlXmlReaderSettings() { };
//The WPF Schema Context is optimized for perf.
XamlXmlReader xxr = new XamlXmlReader(@"c:\temp\rtf.xaml", System.Windows.Markup.XamlReader.GetWpfSchemaContext(), xxrs);
//Calling this API will ensure that any special operations for WPF are done on this XAML node stream.
object root = System.Windows.Markup.XamlReader.Load(xxr);

Believe that will work…my memory and quick test says that it does work. Please comment if I am mistaken.

Published Monday, February 07, 2011 5:39 PM by Rob_Relyea
Filed under: ,

Comments

# Dew Drop – February 8, 2011 | Alvin Ashcraft's Morning Dew@ Tuesday, February 08, 2011 8:33 AM

Pingback from  Dew Drop – February 8, 2011 | Alvin Ashcraft's Morning Dew

# re: Using XXRS and XXR with XR…a how to.@ Tuesday, February 08, 2011 4:58 PM

Hi Rob,

used the method you described and can confirm it works perfectly! Thanks for the info! :)

by Brian W

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Page view counter