Silverlight and Anonymous Type Binding

ScottGu pointed out a seemingly old post that data binding to anonymous types "just works" because anonymous types are just "syntactic sugar" (whatever that means), and from a CLR perspective, they seem a bit real like everyone else. what I would write.

However Mike Hillberg posts that this is not the case with Silverlight, and in my experience I agree with him --- however I Scott was right, since creating these so called "nominal types" is what I thought anonymous types freed us.

Can someone explain why, in the case of Silverlight binding to anonymous types, it doesn't fly.

+2


source to share


3 answers


Mike Hillberg is right, in Silverlight you cannot bind to anonymous types. It's a shame that it solves all sorts of problems, but there you go.

Binding in Silverlight depends on Reflection, and it only supports reflection on public types. Because anonymous types are internal, anonymous types cannot be used in binding.



Why can't Silverlight reflect internal types? I don't know, I would like to know too.

+4


source


This question provides a way to bind to anonymous types in Silverlight.



According to the comments, it also works in Silverlight 3.

0


source


yes, It '2014, I still need to work on SilverNotThatlight, I was solving the problem using ImpromptuInterface

using ImpromptuInterface;
var value = Impromptu.InvokeGet(owner, propertyInfo.Name);
Impromptu.InvokeSet(target, propertyInfo.Name, value);

      

Impromptu does more than that, I think it's worth depending on it

0


source







All Articles