Skip to main content

Microsoft Silverlight

Answered Question Problem with dynamic createFromXamlRSS Feed

(1)

silveraight
silveraight

Member

Member

66 points

23 Posts

Problem with dynamic createFromXaml

 Hi everyone!

First the code: 

var plugin = vidElem.getHost();
var xamlFragment = projArrayIdea;
textBlock = plugin.content.createFromXaml(xamlFragment, true);
infoElem.children.add(textBlock);

Now my Problem:
projArrayIdea is an cdata out of an xml read into an array which looks like this: '<TextBlock....and so far and so on. If i write this instead of projArrayIdea all works fine. but i need to get the data out of the xml! I also checked projArrayIdea and it's exactly the same as when i write it like i told
 
before. I allready tryed things like projArrayIdea.toString(); or projArrayIdea.ToString();.

I mean the variable is write the  createFromXaml works but both together is one big mess!

Guys, is this a BUG or what?

Please Post your thoughts!

Thanks

Mathias 

Dave Britton
Dave Bri...

Member

Member

681 points

229 Posts

Re: Problem with dynamic createFromXaml

Any chance of reposting this whithout all the light bulbs Smile  Then I can try to figure it out.  What is the actual error you are seeing?

=> Dave

Senior Engineer/Dev Manager, Vertigo Software
Vertigo

silveraight
silveraight

Member

Member

66 points

23 Posts

Re: Problem with dynamic createFromXaml

 haha- ,sorry ;)

all the Light bulbs are actually: [ i ]

but without the spaces in between.

Thanks

Mathias 

Dave Britton
Dave Bri...

Member

Member

681 points

229 Posts

Re: Problem with dynamic createFromXaml

Dave Britton:

...  What is the actual error you are seeing? ...

Senior Engineer/Dev Manager, Vertigo Software
Vertigo

silveraight
silveraight

Member

Member

66 points

23 Posts

Re: Problem with dynamic createFromXaml

 Hi! The Problem is that the Xaml text block gets properly written if i just write it in, but when i want to give the createFromXaml the variable ( which has exactly the same data) it wont work! I just wont see the text block.

var preXamlFragment = projArray[currJ][0];
var preXamlFragment1 = preXamlFragment.replace("<![CDATA[","");
var preXamlFragment2 = preXamlFragment1.replace("]]>","");
var xamlFragment = preXamlFragment2.toString();    //'<TextBlock Name="projektTitel" Width="360" Height="800" Canvas.Left="0" Canvas.Top="5" FontFamily="Arial" FontWeight="Bold" TextWrapping="Wrap" Text="Hi, i'm Testtext" ></TextBlock>'
//alert(xamlFragment);
textBlock = plugin.content.createFromXaml(xamlFragment, true);

infoElem.children.add(textBlock);

I thought it would help if i remove the cdata tag, but the result is not better!
at the point where i alert my xamlFragment it says exacty the same as my  TextBlock behind the //.

Why wont this work??

Thanks

Mathias
 


silveraight
silveraight

Member

Member

66 points

23 Posts

Answered Question

Re: Problem with dynamic createFromXaml

 Argh!

i got it! i still had the single quotes in the cdata so that the xamle code was invalid, so when i did the traces it looked like this in the beginning: "'<TextBlock Name="projektTitel" ......

Thanks for the patience Embarrassed

Mathias 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities