从天蓝色检索数据时,列表视图未显示我的结果 [英] List view not showing my Results when retrieving data from azure
本文介绍了从天蓝色检索数据时,列表视图未显示我的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
public List<string> Mycollection { get; set; } = new List<string>();
public async void Button_Clicked(object sender, EventArgs e)
{
string storageConnectionString = "mystring";
CloudStorageAccount storageAccount = DOTFORMS3.Common.CreateStorageAccountFromConnectionString(storageConnectionString);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("tablename");
TableQuery<CustomerEntity> tableQuery = new TableQuery<CustomerEntity>();
foreach (CustomerEntity CustomerEntity in table.ExecuteQuery(tableQuery))
{
Mycollection.Add(CustomerEntity.NAME);
}
await Navigation.PushModalAsync(new Mynewpage());
}
这是我的Mynewpage Xaml代码
and here is my Mynewpage Xaml code
<ContentPage.BindingContext>
<vm:Page1/>
</ContentPage.BindingContext>
<StackLayout>
<Label Text="koool"></Label>
<ListView ItemsSource="{Binding Mycollection }">
</ListView>
<Label Text="koool"></Label>
</StackLayout>
,这是输出的图像在此处输入图像描述一切似乎都很好,但是我想问题出在我使用绑定的方式上
and here is an image of the output enter image description here every thing seems fine ,but I guess the problem lies in the way I am using binding
推荐答案
,您需要将数据传递到页面.这不会自动发生
you need to pass the data to your page. This doesn't happen automatically
await Navigation.PushModalAsync(new Mynewpage(Mycollection));
然后在 Mynewpage
public List<string> Mycollection { get; set; }
public Mynewpage(List<string> data)
{
...
Mycollection = data;
this.BindingContext = this;
...
}
摆脱这个
<ContentPage.BindingContext>
<vm:Page1/>
</ContentPage.BindingContext>
这篇关于从天蓝色检索数据时,列表视图未显示我的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文