次の方法で共有


Using CreateFromXaml() in WPFe? XamlStringBuilder could save you time!

In WPFe JavaScript code, it's handy to be able to build up a xaml string dynamically, then call CreateFromXaml() to create the elements on the fly. What can be a pain is coding up your string buildup in JavaScript.

I wrote a quick tool (depends on 2.0 CLR) that allows you to type or paste xaml XML into a top pane, then generate the equivalent xaml string buildup code in JavaScript. You can then click a "Copy to Clipboard" button, return to your WPFe project, and paste in the string buildup code. (See attached file)

 Hope this is helpful!

Screenshot:  

XamlStringBuilder.exe

Comments

  • Anonymous
    April 06, 2007
    Gavin Gear of the Ink team has created a WinForms app that takes a XAML string and turns it into a javascript

  • Anonymous
    April 06, 2007
    The comment has been removed

  • Anonymous
    April 06, 2007
    Nice. How about support for going the other way around? That way you don't have to save the actual xaml if you want to update it, you can always get back to the xaml from the javascript.

  • Anonymous
    April 14, 2007
    For those of you that attended my talk in Salt Lake City - here's the links I referred to in my talk...

  • Anonymous
    April 18, 2007
    Gavin, you should change the JavaScript output to this: var a = []; a.push("<Canvas....>"); a.push("..."); a.push("</Canvas>"); var xaml = a.join(""); If used often this is a performance benefit while running JavaScript. Michael

  • Anonymous
    April 11, 2011
    its great work but i wonder if this java script code could be used to directly embed xaml in html document  or even convert it to <canvas> html5 elements?