[Ironruby-core] How to run a XAML file?

Jimmy Schementi Jimmy.Schementi at microsoft.com
Sun Nov 15 22:32:29 EST 2009


I was looking through the mailing list archives for unanswered mails ... eek, sorry Shay! Well, if you still have this question ...

You can also load XAML with System::Window::Application.LoadComponent:

# This loads "foo.xaml" into the "canvas" variable
include System
include System::Windows
include System::Windows::Controls
canvas = Canvas.new
Application.load_component canvas, Uri.new("foo.xaml", UriKind.relative)

This only works when foo.xaml has a x:Class equal to the type passed to the first arg to load_component, like x:Class="System.Windows.Controls.Canvas".

~Jimmy

> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-
> bounces at rubyforge.org] On Behalf Of Shay Friedman
> Sent: Friday, July 24, 2009 2:34 AM
> To: ironruby-core at rubyforge.org
> Subject: [Ironruby-core] How to run a XAML file?
> 
> Hi,
> 
> I have a WPF xaml file and I'd like to execute it using IronRuby. I know I
> can use the System::Windows::Markup::XamlReader.parse method, but is there
> another way?
> 
> Using the XamlReader class makes registering events, for example, kind of an
> irritating task.
> 
> Thanks,
> Shay.
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list