Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么Xamarin.Forms绑定不能与默认访问器一起使用?_C#_Data Binding_Xamarin.forms - Fatal编程技术网

C# 为什么Xamarin.Forms绑定不能与默认访问器一起使用?

C# 为什么Xamarin.Forms绑定不能与默认访问器一起使用?,c#,data-binding,xamarin.forms,C#,Data Binding,Xamarin.forms,我有一处房产 public List<WebApi.UserChatRto> Chats { get; set; } 公共列表聊天{ 获得;设置; } 我绑定到ListView的 <ListView ItemsSource="{Binding Chats}"> 这很有效。现在如果我将属性声明更改为 public List<WebApi.UserChatRto> Chats; 公开列表聊天; l

我有一处房产

    public List<WebApi.UserChatRto> Chats {
        get; set;
    }
公共列表聊天{
获得;设置;
}
我绑定到ListView的

       <ListView ItemsSource="{Binding Chats}">

这很有效。现在如果我将属性声明更改为

    public List<WebApi.UserChatRto> Chats;
公开列表聊天;
listview将为空。
为什么?

绑定仅适用于属性,而不适用于字段

参考


绑定仅适用于属性,不适用于字段

参考