【发布时间】:2020-10-03 09:46:56
【问题描述】:
希望这是我的 listview 最后一期,这里的问题是我的代码
public List<CustomerEntity> CET1 { get; set; } = new List<CustomerEntity>();
public async void MakeupBTN_Clicked(object sender, EventArgs e)
{
string storageConnectionString = "mystringconnection";
CloudStorageAccount storageAccount = DOTFORMS3.Common.CreateStorageAccountFromConnectionString(storageConnectionString);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("mytablename");
TableQuery<CustomerEntity> tableQuery = new TableQuery<CustomerEntity>();
foreach (CustomerEntity MyCustomerEntity in table.ExecuteQuery(tableQuery))
{
CET1.Add(MyCustomerEntity);
}
await Navigation.PushModalAsync(new pagggge(CET1));
}
这是来自 pagggge 的代码
public List<CustomerEntity> MCET { get; set; } = new List<CustomerEntity>();
public pagggge( List<CustomerEntity> cet)
{
InitializeComponent();
cet = MCET;
this.BindingContext = this;
}
这是我的 xaml 代码
<ListView ItemsSource="{Binding MCET}" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Label Text="{Binding PLACE}"></Label>
<Label Text="{Binding NAME}"></Label>
<Label Text="{Binding PRICE}"></Label>
<Label Text="{Binding TIME}"></Label>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
她是我的客户类
public class CustomerEntity : TableEntity
{
public CustomerEntity()
{
}
public string NAME { get; set; }
public string PLACE { get; set; }
public string PRICE { get; set; }
public string TIME { get; set; }
}
在所有这些之后,nathing 出现在我的列表视图中,那么问题可能出在哪里?
【问题讨论】:
-
cet = MCET;这会将传递给您的构造函数的变量设置为您的本地属性。我的假设是你会想要这个相反的方式。 -
是的,你是对的,它应该是`MCET = cet`。谢谢
-
把它写成答案,这样我就可以接受了
-
完成,祝你的项目好运!
-
非常感谢您的帮助:)
标签: c# azure xaml xamarin.forms