17

Does anyone know if you can use data binding with anonymous types in Silverlight 4? I know you can't in previous versions of silverlight, you can only databind to public class properties and anonymous type properties are internal.

Just wondering if anyone has tried it in silverlight 4?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Anthony
  • 1,651
  • 1
  • 17
  • 31

1 Answers1

39

You can... If you expose your internals.

Place this in your AssemblyInfo.cs:

[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Windows")]
Spontifixus
  • 6,570
  • 9
  • 45
  • 63
Jason Jarrett
  • 3,857
  • 1
  • 27
  • 28
  • If you want to use things like Datagrid sorting you need to also include the [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Windows.Data")] other wise you get a nasty security exception. – Anthony May 20 '10 at 18:17