1

Closed

CreateFromXaml Issue

description

I can't seem to find a way to create an object from straight Xaml text when using this project. If I try the following:
 
var myCanvas = this.plugIn.content.createFromXamlDownloader(sender, "myCanvas.xaml");
 
I receive an error that "plugIn" does not have any properties.
 
So I am forced to use a strongly typed statement, such as:
 
var myCanvas = Canvas.createFromXaml(downloader.getResponseText("myCanvas.xaml"));
 
But this is not supported. The "createFromXaml" method does not allow you to give it the Xaml to create the Canvas. It requires only a host.
 
Am I missing something?
 
I was able to get around the issue by editing the Canvas.createFromXaml method in the "intellisense.js" file to the following:
 
Canvas.createFromXaml = function(Host, Xaml)
{
/// <returns type="Canvas" />
if (!Host)
    return;
try { 
if (Host.content)
    if (Xaml) {
        return new Canvas(Host.content.createFromXaml(Xaml));
    } else {
        return new Canvas(Host.content.createFromXaml("<Canvas />"));
    }
} catch (ex) {}
if (Host.getHost)
    return Canvas.CreateNew(Host.getHost());
return;
}
 
So that if there is a "Xaml" argument it will create the element using the specified xaml.
 
But, I don't like editing the library, so if there is a better way please do tell.
Closed Oct 25, 2007 at 10:49 PM by JustinJosefAngel
Chief7 indicated this is not currently something he needs.

comments

JustinJosefAngel wrote Oct 18, 2007 at 11:27 AM

Hey Cheif,

Is this the syntax you'd like to have? a CreateFromXaml with input XAML?

Right now, the syntax that's supported is creating the XAML using the host and only then converting it to the approprite type.

Please tell me if that's a feature you'd like to have - it's about 5 seconds work to add the syntax you asked for.

wrote Oct 25, 2007 at 10:49 PM

wrote Feb 1, 2013 at 4:39 AM

wrote May 14, 2013 at 8:26 AM