Skip to content

Tool to convert from XAML to Code

March 15, 2007

[update 6/10/2007: I’ve posted a version of this Xaml to Code tool on http://XamlT.com.  Select sample.xaml from the right side of the home page of the application and choose open.]

This has been a frequent request…

Today, I saw a WPF forum post asking again, so I started building this.  I’m building it on top of some classes that help store information about types, properties, etc…

If you don’t see anything in 1-2 weeks, please ping me with a comment on this post.

 

[Update: 3/16]

Here is a picture of how it looks now:

(as you may be able to see by the code, i have the basics going…)

 

Next steps:

  • Treating properties of type double appropriately
  • TypeConverters (don’t call them from code…figure out the associated code…)
  • Property Elements
  • Markup Extensions
  • More?

From → XAML (non-UI)

19 Comments
  1. Jerryn permalink

    My question is this: Why? Other than for learning purposes, what could possibly be the point?

  2. Rob permalink

    I also want to understand when people want this.
     
    i can think of a few reasons:
    1) i know how to do it in markup, but I haven\’t figured out how to do it in code.
    2) i want to better obfuscate some functionaity…IL has better obfuscation than baml.
    3) i am the wpf team and i want to continue to test the perf of baml and continue to make sure it compares with code.
    4) more?
     
    Thoughts?

  3. Chris Russi permalink

    Rob,
    This raises a question that has been in my mind since I started learning WPF.  Are there situations where XAML markup is better (i.e. more efficient) than code (or vice versa)?  I understand that there are some things that can only be done in code or only done in markup.  But, when something can be done in both; what is the preferred method, markup or code?  I understand that "more efficient" is somewhat vague.  What I mean is "anything" that makes it better (i.e. renders faster, easier to maintain, easier to modify, easier to automate).
    Chris

  4. Rob permalink

    A long time ago, the markup compiler used to be able to generate code instead of baml.  We cut that feature since at the time BAML was nearly as fast.  Since then, we have been able to optimize BAML even more.
     
    However, I don\’t thnk we did a great job of continuing to test that we continued to be faster than straight code.  We are writing this code generator again to test against baml and make sure we find any perf optimizations that we can to.
     
    So, in short, we believe baml to be faster than code…but we\’ll be measuring more scientifically soon.
     
    Markup, in general, is what visual designers target, and how many formats (2d, 3d) get imported into WPF artifacts.  I lean towards markup unless code is better for some reason…  (but being focused on xaml, i am probably not the most objective person here…)  I\’d love to hear what others think.
    Thx, Rob

  5. Rob permalink

    This is on hold for a bit.  Good progress but not shippable or previewable yet…Likely won\’t be for months…Will pick it back up at some point…

  6. Douglas permalink

    Hi Rob,
    Here at iBloks we have a very skillled designer doing Storyboards for us in Expressions.  We have code which applies some of these 2D effects to 3D via visual brushes.  As such I need to manually transcode Xaml -> C#.  At the end of the day I have to understand the concept his code is attempting and then make the translation.  I think that your tool would be immensely helpful.  How can I get a copy of your .exe in it\’s current form?
     
    From a learning perspective,I\’ve always wanted a tool like this to allow me to prototype C# code. 
    Thanks!
    –Doug

  7. Rob permalink

    Glad it will be helpful to you.
    I\’m hoping to release this externally in the next 1-3 weeks…
    Ping me via email or more comments if that doesn\’t happen.

  8. Unknown permalink

    ht26fg gtk06y wow gold wow gold wow gold wow gold wow gold 股票软件 股票软件 进口轴承 美国签证 法国签证 全教振 中高年 転職 大智慧 炒股软件 FX NSK轴承 TIMKEN轴承 水洗厂 全教振 全教振 炒股软件 大智慧 深圳网页制作 深圳网页制作 进口轴承 NSK轴承 干洗设备 朗阁培训 英国签证 中高年 転職 FX 黑马股 毛穴 黒ずみ 毛穴 黒ずみ TIMKEN轴承 出会い系 コスメ コスメ wow gold wow gold wow gold wow gold wow gold wow gold wow gold wow gold wow gold wow gold wow gold wow gold

  9. Unknown permalink

    http://www.usome.com  http://www.usome.com 游商贸 B2B 3.0 电子商务 3.0 中国最强的电子商务搜索引擎 免费建立企业网站,浏览海量采购信息 游商贸 浏览海量采购信息 游商贸 网址导航 游商贸 新闻搜索

  10. Unknown permalink

    她的人生杭州装饰注定不能由自己杭州中央空调销售决定,当踏入杭州家装这深宅大院,她就知道杭州空调维修今生今世都将被束缚。三从四德的为妻之道杭州办公室装修她是懂的呀,只是为什么杭州装修面对他和他的所爱,她的心却回复杭州空调维修公司不了原来的杭州装饰公司简单?他怎么可能杭州空调移机爱上她呢?他心系杭州家政国家大事,也有青梅竹马的恋人, 他要杭州厂房装修怎么取舍她与她呵!而国事与情事杭州店面装修孰重孰轻?他要杭州空调维修怎么掂量这个生活中杭州装修公司越来越不可缺少的女子?

  11. Unknown permalink

    アーネスト  設計事務所 行政書士  アクサ アクサダイレクト     三井ダイレクト 有料老人ホーム  現金化   クレジットカード 現金化    ドロップシッピング  医院開業   ショッピング枠 現金化 為替     看護  ウェディング  結婚式   ウェディング 結婚式 沖縄旅行 クレジットカード 現金化  外国為替  引越  副業  賃貸  不動産 競馬予想 出会い系

  12. Unknown permalink

    Welcome to enter (wow gold) and (wow power leveling) trading site, (wow gold) are cheap, (wow power leveling) credibility Very good! Quickly into the next single! Key words directly to the website click on transactions! -144423025267992

  13. Unknown permalink

    不動産投資 プレジデント インテリアコーディネータ リフォーム 東京 リフォーム 大阪 不動産 査定 不動産 買取 不動産 売買 不動産 鑑定 不動産 売却  広島 不動産 札幌 不動産 仙台 不動産 大阪 不動産 横浜 不動産 名古屋 不動産 福岡 不動産 京都 不動産 埼玉 不動産 千葉 不動産 静岡 不動産 神戸 不動産 浜松 不動産 堺市 不動産 川崎市 不動産 相模原市 不動産 姫路 不動産 岡山 不動産 明石 不動産 鹿児島 不動産 北九州市 不動産 熊本 不動産 収益物件 システム開発 webシステム開発

  14. Unknown permalink

    Amberdigital Branch,Southern Stars Enterprises Co is specializing in the development and manufacturing of ad players, advertisement player and LCD advertisings. Established in 1996, we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

    amberdigital Contact Us
    Southern Stars Enterprises Co (Hong Kong Office)
    Add:3 Fl, No.2, Lane 2, Kam Tsin Tsuen, Sheung Shui, Hong Kong
    Tel:+852 2681 4099
    Fax:+852 2681 4586
    Southern Stars Enterprises Co (Shenzhen Office)
    Add:DE, 16/F, Building 2, Nanguo Tower, Sungang Road, Shenzhen, China
    Tel:+86 755 2592 9100
    Fax:+86 755 2592 7171
    E-mail:sstar@netvigator.com
    website:www.amberdigital.com.hk
    alibaba:amberdigital.en.alibaba.com[aidadccdfgaagh]

  15. Unknown permalink

    RMT 株式投資 結婚式 演出 太陽光発電 転職 看護師 釣具 会社設立 バイアグラ データ復旧 フローリング データ復元 投資 横浜 賃貸 ショッピング枠 現金化 データ復旧 テレマーケティング

  16. Unknown permalink

    ウィークリーマンションオーク 不動産担保ローン データ復旧  ウエディング  お取り寄せグルメ 横浜中華街 キャッシング 害虫駆除 介護 釣り 結婚指輪  RAID復旧 ウエディングドレス 子宮筋腫 治験 メタボ対策
     

  17. Unknown permalink

    債務整理 手 汗 手掌多汗症 医師 求人 お見合い  就職ナビ 医師 募集 マンションリフォーム 永代供養 アンチエイジング 化粧品 特許事務所 ウォーキングシューズ 広告業界 アダルトグッズ 永代供養 会社設立 永代供養

  18. Unknown permalink

    マッスルトレーナー 納骨堂   東京都 墓地  有料老人ホーム サウナスーツ 美容学校 マンスリーマンション 東京 別れさせ屋 弁理士 メル友 住宅リフォーム 法律事務所 求人 アメリカ ビザ  脱腸 痔 医師 転職

  19. andrew permalink

    Any chance you have this available anymore? I was looking for a tool like this and would be very interested. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: