ExpandoObject binding in Silverlight

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

dynamic o = new ExpandoObject(); o.Foo = "Hello"; DataContext = o; <TextBlock Text="{Binding Foo}"/> 

This does not work in Silverlight 5. Is there a way to make it work, or who has links to this problem?

+4
source share
1 answer

In Silverlight 5, they did not add a default mechanism for binding to dynamic objects and instead added a new ICustomTypeProvider interface. And this interface has also not been added to ExpandoObject, but with expando you should use indexer binding, as it is an IDictionary<string, object> that implements INotifyPropertyChanged .

 <TextBlock Text="{Binding [Foo]}"/> 
+4
source

Source: https://habr.com/ru/post/1416044/