Skip to main content
Home Forums Silverlight Programming Programming with JavaScript Problem with dynamic createFromXaml
5 replies. Latest Post by silveraight on October 15, 2007.
(1)
silveraight
Member
66 points
23 Posts
10-12-2007 7:46 AM |
Hi everyone!
First the code:
var plugin = vidElem.getHost(); var xamlFragment = projArray;textBlock = plugin.content.createFromXaml(xamlFragment, true);infoElem.children.add(textBlock);
Now my Problem:projArray 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 projArray all works fine. but i need to get the data out of the xml! I also checked projArray and it's exactly the same as when i write it like i told before. I allready tryed things like projArray.toString(); or projArray.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 Bri...
681 points
229 Posts
10-12-2007 10:24 AM |
Any chance of reposting this whithout all the light bulbs Then I can try to figure it out. What is the actual error you are seeing?
=> Dave
10-12-2007 10:59 AM |
haha- ,sorry ;)
all the Light bulbs are actually: [ i ]
but without the spaces in between.
10-12-2007 11:37 AM |
Dave Britton: ... What is the actual error you are seeing? ...
... What is the actual error you are seeing? ...
10-15-2007 3:39 AM |
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??
10-15-2007 8:40 AM |
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