R – Silverlight and binding to anonymous types


ScottGu indicated in an admittedly old post that databinding to anonymous types "just works" because anonymous types are just "syntactic sugar" (whatever that means) and from the CLR perspective they are every bit as real a type as anything I would write up.

However Mike Hillberg posts that such is not the case with silverlight, and in my experience I would agree with him — however I wish Scott was right, as building these so-called "nominal types" is what I thought anonymous types liberated us from.

Could somebody please explain why, in the case of Silverlight binding to anonymous types doesn't fly.

Best Solution

Mike Hillberg is correct, in Silverlight you cannot bind to anonymous types. A real pity cause it would solve all sorts of problems but there you go.

Binding in Silverlight depends on Reflection and it only supports Reflecting on public types. Since Anonymous types are internal, anonymous types can't be used in binding.

Why can't Silverlight reflect on internal types? Dunno, I'd like to know too.

Related Question