Anton Duzenko Anton Duzenko - 1 year ago 148
C# Question

Why Xamarin.Forms bindings do not work with default accessors?

I have a property

public List<WebApi.UserChatRto> Chats {
get; set;
}


that I bind to a ListView

<ListView ItemsSource="{Binding Chats}">


That works. Now if I change the property declaration to

public List<WebApi.UserChatRto> Chats;


the listview will be empty.
Why?

Answer Source

Binding only works with properties, not with fields.

Reference https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/data_binding_basics/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download