<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>mortimercui (崔浩伦)</title>
    <link>https://ruby-china.org/mortimercui</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>新手问题 blend 与 ironruby 协同工作的问题</title>
      <description>&lt;p&gt;一个小项目，我准备用 blend 来开发 WPF 界面，并用 ironruby 解析 blend 生成的 xaml 文件。但是遇到了问题。为了排除问题，我试验了一个最简情况。用 blend 新建一个 WPF 界面，这时 blend 生成了两个 xaml 文件：app.xaml 和 mainwindow.xaml。我在 ironruby 里解析 mainwindow.xaml 文件，主要代码如下&lt;/p&gt;

&lt;p&gt;mainwnd_xaml = File.open("mainwindow.xaml", "r").read
mainwnd          = System::Windows::Markup::XamlReader.parse(mainwnd_xaml)
dpc_app          = System::Windows::Application.new
dpc_app.run mainwnd&lt;/p&gt;

&lt;p&gt;运行后报错：
PresentationFramework:0 in 'load' (System::Windows::Markup::XamlParseException)
    from PresentationFramework:0 in 'load' 
    from PresentationFramework:0 in 'parse'&lt;/p&gt;

&lt;p&gt;如果我把 mainwindow.xaml 里面的内容替换为一个从其他地方抄的 gui 界面代码就不会有问题，可见环境配置方面没有问题。我也仔细对比过 blend 生成的 xaml 代码，与其他地方抄的 gui 界面代码，没有明显的区别。不知道问题究竟出在哪里？&lt;/p&gt;</description>
      <author>mortimercui</author>
      <pubDate>Tue, 25 Feb 2014 16:32:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/17479</link>
      <guid>https://ruby-china.org/topics/17479</guid>
    </item>
  </channel>
</rss>
