# Databinding in WPF against IronRuby objects

**URL:** <https://www.ruby-forum.com/t/databinding-in-wpf-against-ironruby-objects/192487>\
**Category:** IronRuby\
**Created:** [July 31, 2010, 3:24am UTC](https://www.ruby-forum.com/t/databinding-in-wpf-against-ironruby-objects/192487 "2010-07-31T03:24:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bguan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8edcca/32.png) [@bguan](https://www.ruby-forum.com/u/bguan)\
**Post date:** [July 31, 2010, 3:24am UTC](https://www.ruby-forum.com/t/databinding-in-wpf-against-ironruby-objects/192487/1 "2010-07-31T03:24:48Z")

</div>

All,

I posted this on StackOvervlow, but I thought I would notify this list  
of my  
question, in case someone here understands what is going on…

Basically, I am finding that data binding to properties on IronRuby  
objects  
works for some controls, but fails on others. I have an example of it  
here:

> <https://stackoverflow.com/questions/3376349/why-do-some-wpf-binding-fail-against-ironruby-properties>

Anyone have any idea why this happens?  
Brian

---

<div class="post-metadata">

**Author:** ![bguan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8edcca/32.png) [@bguan](https://www.ruby-forum.com/u/bguan)\
**Post date:** [July 31, 2010, 7:51am UTC](https://www.ruby-forum.com/t/databinding-in-wpf-against-ironruby-objects/192487/2 "2010-07-31T07:51:36Z")

</div>

I find IronRuby types hard-to-work-with sometimes when it comes to WPF  
data  
binding. What I do as a workaround is creating the data entity classes  
in C#  
and initialize them from IronRuby code.

To fix your sample WPF app, I used the CLR string instead of IronRuby’s.  
So  
instead of:

```
def initialize
  @ImageLocation = "http://www.ironruby.net/@api/deki/site/logo.png"
end

```

You need to do:

```
def initialize
  @ImageLocation =

```

“[http://www.ironruby.net/@api/deki/site/logo.png](http://www.ironruby.net/@api/deki/site/logo.png)”.to\_clr\_string  
end

Shay.
