Xamarin Forms supports binding to indexed properties. But do you know how to trigger a PropertyChanged event on such a property so that the binding engine gets the updated value?

Binding to indexed properties

Binding to an indexed property in Xamarin Forms is simple. Imagine my ViewModel has an indexed property:

I can simply bind to it using the following syntax: <Label Text="{Binding [123]}" />  where 123 is the index I pass to the property.

Notifying the UI

If I now update the underlying data collection (for example: Data["123"] = "Ninjas"; ), my UI won’t be notified about this change. However, I can notify my UI by triggering the PropertyChanged event, passing ‘Item‘ as property name:

You can also use the following syntax if you only want to notify the UI about one particular element that has changed:

Easy, right? You just have to know it… 😉


If you want to try it our yourself, here is the complete code: