SIlverlight, unlike WPF, is incapable of binding to dynamic properties.
 Static properties, on the other hand are no problem.  One way around this
is to create a string indexer on your class (this[string index]) that
returns the property by name.  Then, in the XAML, you can bind using array
(square-bracket) syntax:  <TextBlock text="{Binding [property]" />.  I do
this in C# a lot, and I am pretty sure it translates the same in IronRuby:
http://houseofbilz.com/archives/2010/05/14/adventures-in-mvvm-my-viewmodel-base-silverlight-support/

<http://houseofbilz.com/archives/2010/05/14/adventures-in-mvvm-my-viewmodel-base-silverlight-support/>Good
luck,
Brian

On Mon, Sep 27, 2010 at 3:58 PM, Charles Strahan <
charles.c.stra...@gmail.com> wrote:

> That's my understanding. Silverlight will only reflect over properties, as
> it does not use type descriptors - nor does it know how to determine a
> dynamic object's attributes.
>
> If you use attr_accessor, I believe that'll result in corresponding
> properties being added to the generated class.
>
> If all else fails, you could use the Silveright DataSet (
> http://silverlightdataset.net/silverlightdataset/Default.aspx) project to
> create bindable objects. Behind the scenes, it will create a class with
> properties that match the column names you pass in. I used it in a recent
> project where I needed to display a DataGrid bound to the results of an
> IDataReader, where the columns weren't known until runtime. Just throwin' it
> out there.
>
> -Charles
>
>
> On Mon, Sep 27, 2010 at 1:26 PM, Christopher Bennage <li...@ruby-forum.com
> > wrote:
>
>> I'm beginning to research this, but I don't want to reinvent the wheel
>> if there is already a solution out there.
>>
>> My understanding of the problem is this:
>> Data binding in Silverlight does not work because the system doesn't
>> know how to handle dynamic objects. This is not the case in WPF because
>> the binding system there uses type descriptors, but type descriptors
>> aren't available in Silverlight.
>>
>> Is this your understanding as well?
>> Has there been any creative solutions to this problem?
>> Does anyone have details on what the binding system is really doing in
>> Silverlight?
>> --
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> Ironruby-core mailing list
>> 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
>
>
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to