4

In WPF, you can bind against ExpandoObject and other dynamic types:

    dynamic o = new ExpandoObject();
    o.Foo = "Hello";
    DataContext = o;

<TextBlock Text="{Binding Foo}"/>

This doesn't work in Silverlight 5. Is there a way to make it work or does anyone have links to this issue?

John
  • 6,693
  • 3
  • 51
  • 90

1 Answers1

4

In Silverlight 5 they didn't add a default mechanism for binding to dynamic objects and instead added a new interface ICustomTypeProvider. And that interface wasn't added to an ExpandoObject either, but with expando you should be able to use the indexer binding since it is an IDictionary<string, object> that implements INotifyPropertyChanged.

<TextBlock Text="{Binding [Foo]}"/>
jbtule
  • 31,383
  • 12
  • 95
  • 128