有没有办法使用Ruby和WPF?

dsp*_*099 4 ruby wpf xaml visual-studio-2010

我发现"Ruby in Steel",但(我认为)只适用于visual studio 2008,不支持新的WPF/XAML.

有这样的事情还是这些管道的梦想?:)

Vas*_*ich 5

查看IronRuby 1.1\Samples\目录中的DiskUse项目.它使用WPF和XAML.例如,它是如何加载xaml的:

module DialogUtil
  def load_xaml(filename)
    f = IO::FileStream.new(filename, IO::FileMode.Open, IO::FileAccess.Read)
    begin
      element = Markup::XamlReader::Load(f)
    ensure
      f.close
    end
    element
  end

  module_function :load_xaml
end 
Run Code Online (Sandbox Code Playgroud)

然后使用它:

@window = DialogUtil.load_xaml("mainWindow.xaml")
@window.closing { @app.shutdown }
@windowTitle = @window.title
...
@window.show
Run Code Online (Sandbox Code Playgroud)

是的,它适用于VS2010 - http://ironruby.codeplex.com/