Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class BamlReader
- {
- public static object Load(Stream stream)
- {
- ParserContext pc = new ParserContext();
- MethodInfo loadBamlMethod = typeof(XamlReader).GetMethod("LoadBaml",
- BindingFlags.NonPublic | BindingFlags.Static)
- return loadBamlMethod.Invoke(null, new object[] { stream, pc, null, false });
- }
- }
- // Usage:
- StreamResourceInfo sri = System.Windows.Application.GetResourceStream(
- new Uri("/MyAssemblyName;component/MyResourceDict.xaml", UriKind.Relative));
- ResourceDictionary resources = (ResourceDictionary)BamlReader.Load(sri.Stream);
Add Comment
Please, Sign In to add comment