public static void LoadComponent (object component, Uri resourceLocator)
{
if (component == null)
throw new ArgumentNullException ("component");
if (resourceLocator == null)
throw new ArgumentNullException ("resourceLocator");
StreamResourceInfo sr = GetResourceStream (resourceLocator);
// Does not seem to throw.
if (sr == null)
return;
using (var v = Value.FromObject (component)) {
// XXX still needed for the app.surface reference when creating the ManagedXamlLoader
// Application app = component as Application;
string xaml = new StreamReader (sr.Stream).ReadToEnd ();
Assembly loading_asm = component.GetType ().Assembly;
ManagedXamlLoader loader = new ManagedXamlLoader (loading_asm, resourceLocator.ToString(), Deployment.Current.Surface.Native, PluginHost.Handle);
loader.Hydrate (v, xaml);
}
}