# IronRuby with Silverlight question

**URL:** <https://www.ruby-forum.com/t/ironruby-with-silverlight-question/134171>\
**Category:** IronRuby\
**Created:** [April 8, 2008, 4:10pm UTC](https://www.ruby-forum.com/t/ironruby-with-silverlight-question/134171 "2008-04-08T16:10:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [April 8, 2008, 4:10pm UTC](https://www.ruby-forum.com/t/ironruby-with-silverlight-question/134171/1 "2008-04-08T16:10:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [April 8, 2008, 4:14pm UTC](https://www.ruby-forum.com/t/ironruby-with-silverlight-question/134171/2 "2008-04-08T16:14:01Z")

</div>

Have you looked at silverlight.rb from our [http://dynamicsilverlight.net](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](http://www.iunknown.com/2008/03/dynamic-silve-2.html)

Thanks,  
-John

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [April 8, 2008, 4:52pm UTC](https://www.ruby-forum.com/t/ironruby-with-silverlight-question/134171/3 "2008-04-08T16:52:28Z")

</div>

> Have you looked at silverlight.rb from our [http://dynamicsilverlight.netsamples](http://dynamicsilverlight.netsamples)?

It’s all there - thanks for the link!

cheers

Thibaut
