Those are sufficient to flag a member as a property, but not necessary. There are plenty of cases when programmers use a bare method in a place where that they would still want to databind to it.
Currently, attr_reader by itself won’t create a “property”; it also needs the writer. This is arguably a bug. The combination (or attr_accessor) should work. From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Monday, July 20, 2009 7:27 AM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] Data Binding to IronRuby Objects in WPF but wouldn't linking those to attr_reader, attr_writer and attr_accessor work? At least then you know which things are meant to be properties. I don't mind using something like clrattr_reader etc. to get a different behavior and something to expand upon. because then it becomes inotify_attr_reader or something, later on for INotifyPropertyChanged implementations. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero GSM: +32.486.787.582 Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Mon, Jul 20, 2009 at 4:10 PM, Curt Hagenlocher <cu...@microsoft.com<mailto:cu...@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-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> [mailto:ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>] On Behalf Of Shay Friedman Sent: Saturday, July 18, 2009 9:12 AM To: ironruby-core@rubyforge.org<mailto:ironruby-core@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@rubyforge.org<mailto:Ironruby-core@rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core