public T CreateFromResource <T>(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo) where T : new() { var resourceLoadingResponse = Forms.Internals.ResourceLoader.ResourceProvider2?.Invoke(new Forms.Internals.ResourceLoader.ResourceLoadingQuery { AssemblyName = assembly.GetName(), ResourcePath = resourcePath }); var alternateResource = resourceLoadingResponse?.ResourceContent; if (alternateResource != null) { var rd = new T(); XamlLoader.Load(rd, alternateResource, resourceLoadingResponse.UseDesignProperties); return(rd); } var resourceId = XamlResourceIdAttribute.GetResourceIdForPath(assembly, resourcePath); if (resourceId == null) { throw new XamlParseException($"Resource '{resourcePath}' not found.", lineInfo); } using (var stream = assembly.GetManifestResourceStream(resourceId)) { if (stream == null) { throw new XamlParseException($"No resource found for '{resourceId}'.", lineInfo); } using (var reader = new StreamReader(stream)) { var rd = new T(); rd.LoadFromXaml(reader.ReadToEnd()); return(rd); } } }
internal static TXaml LoadFromXaml <TXaml>(this TXaml view, string xaml, Assembly rootAssembly) { XamlLoader.Load(view, xaml, rootAssembly); return(view); }
public static TXaml LoadFromXaml <TXaml>(this TXaml view, Type callingType) { XamlLoader.Load(view, callingType); return(view); }
public static TXaml LoadFromXaml <TXaml>(this TXaml view, string xaml) { XamlLoader.Load(view, xaml); return(view); }
public static void LoadFromXaml(this object view, string xaml) { XamlLoader.Load(view, xaml); }