Building IronRuby WPF GUIs

99封情书 提交于 2019-12-02 08:48:00

问题


This may be a silly question but I was under the impression that it was possible to use IronRuby and MS Visual Studio 2010 together to sort of build interfaces\edit XAML in one window and code ruby in the other?

Is this only possible to do with C#, Basic and C++ ?

I've browsed SO and seen some IronRuby snippets like this one:

button1.click do |sender, args|
    MessageBox.show("Hello World!")
end

So it stands to reason you can create GUIs somehow, but is the visual gui creator not available for ironruby?


回答1:


In order to build GUIs you should use XAML with WPF. You can create XAML with the editor in Visual Studio. Running a XAML file is possible with:

require "PresentationFramework"
include System::Windows
include System::Windows::Markup

xaml = File.Open('d:/app/window1/xaml', "r").read
@root = System::Windows::Markup::XamlReader.parse(xaml)

app = System::Windows::Application.new
app.run @root

Please refer to IronRuby Unleashed for more information



来源:https://stackoverflow.com/questions/8320180/building-ironruby-wpf-guis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!