[Ironruby-core] Data Binding to IronRuby Objects in WPF

Ryan Riley ryan.riley at panesofglass.org
Mon Jul 20 10:16:30 EDT 2009


Ryan Riley
ryan.riley at panesofglass.org
http://panesofglass.org/
http://wizardsofsmart.net/


On Mon, Jul 20, 2009 at 9:10 AM, Curt Hagenlocher <curth at microsoft.com>wrote:

> This should work under desktop WPF (though not under Silverlight) because
> IronRuby objects implement ICustomTypeDescriptor. But consider the following
> code:
>
> class Drive
>  def letter
>    'C'
>  end
>  def format
>    # format the hard drive
>  end
> end
>
> How do we know what the "properties" of Drive are? For obvious reasons, we
> would want to return "letter" but not "format". The way I protected against
> this was to return only those names which have both an arity 0 getter and an
> arity 1 setter. In other words, the above class would also need a
>
>  def letter= value
>    # raise some kind of "not supported" exception
>  end
>
> in order for the ICustomTypeDescriptor implementation to recognize "letter"
> as a property.
>
> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:
> ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman
> Sent: Saturday, July 18, 2009 9:12 AM
> To: ironruby-core at rubyforge.org
> Subject: [Ironruby-core] Data Binding to IronRuby Objects in WPF
>
> Hi there,
>
> I'm trying to databind IronRuby objects to a WPF listbox with no success
>
> My data is a Ruby array of objects. The array seems to be bound fine as
> I see the expected number of rows in the listbox. However, every object
> within the array fails to bind correctly. I tried the object to be a
> Ruby hash or a custom class without success… WPF wouldn't display the
> correct value.
>
> When I tried to create an array of CLR classes, it worked.
>
> Will it work in the  future?
>
> Thanks,
> Shay.
>
> ----------------------------
> Shay Friedman
> http://www.IronShay.com
> Follow me: http://twitter.com/ironshay
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090720/b932e8c7/attachment.html>


More information about the Ironruby-core mailing list