IronRuby with Silverlight question

Hi

I’m not sure ironruby-core is the right place for such a question,
although
I don’t know about any other forum. Is it adequate to post this here ?

My question is : I’m wondering if the following code can be simplified:

=======================
include System::Windows
include System::Windows::Controls

root = Application.Current.LoadRootVisual(UserControl.new(), “app.xaml”)

root.find_name(‘HelloLabel’).mouse_left_button_down do |sender,args|
sender.text = “#{sender.text} - Hello from IronRuby !”
end

Specifically the root loading seems a bit overly complicated at first (I
could move this to a helper function though).

As well I’m wondering if it’s somehow possible to have a
root.hello_label
which would map to find_name(“HelloLabel”) - this could be implemented
using
method_missing; maybe there is already an existing helper to do that ?

any advice will be most welcome!

cheers

Thibaut

Have you looked at silverlight.rb from our http://dynamicsilverlight.net
samples? If it’s not there, look at the Part 3 sample from my intro to
Ruby + Silverlight blog post:

http://www.iunknown.com/2008/03/dynamic-silve-2.html

Thanks,
-John

Have you looked at silverlight.rb from our http://dynamicsilverlight.netsamples?

It’s all there - thanks for the link!

cheers

Thibaut

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs