/// <summary> /// Loads XAML from a stream. /// </summary> /// <param name="stream">The stream containing the XAML.</param> /// <param name="localAssembly">Default assembly for clr-namespace</param> /// <param name="rootInstance"> /// The optional instance into which the XAML should be loaded. /// </param> /// <param name="uri">The URI of the XAML</param> /// <returns>The loaded object.</returns> public object Load(Stream stream, Assembly localAssembly, object rootInstance = null, Uri uri = null) { if (!UseLegacyXamlLoader) { return(AvaloniaXamlIlRuntimeCompiler.Load(stream, localAssembly, rootInstance, uri, IsDesignMode)); } var readerSettings = new XamlXmlReaderSettings() { BaseUri = uri, LocalAssembly = localAssembly, ProvideLineInfo = true, }; var context = IsDesignMode ? AvaloniaXamlSchemaContext.DesignInstance : AvaloniaXamlSchemaContext.Instance; var reader = new XamlXmlReader(stream, context, readerSettings); object result = LoadFromReader( reader, AvaloniaXamlContext.For(readerSettings, rootInstance)); var topLevel = result as TopLevel; if (topLevel != null) { DelayedBinding.ApplyBindings(topLevel); } return(result); }
public static object Load(Stream stream, Assembly localAssembly, object rootInstance = null, Uri uri = null, bool designMode = false) => AvaloniaXamlIlRuntimeCompiler.Load(stream, localAssembly, rootInstance, uri, designMode);
public object Load(Stream stream, Assembly localAsm, object o, Uri baseUri, bool designMode) { return(AvaloniaXamlIlRuntimeCompiler.Load(stream, localAsm, o, baseUri, designMode)); }