C# 以Xamarin表单显示数据列表
我的应用程序从firebase后端检索数据。检索数据并将其放入列表对象中 列表类型及其变量C# 以Xamarin表单显示数据列表,c#,firebase,xamarin,xamarin.forms,C#,Firebase,Xamarin,Xamarin.forms,我的应用程序从firebase后端检索数据。检索数据并将其放入列表对象中 列表类型及其变量 public class UserLogs { public Guid UserID { get; set; } public string logData { get; set; } public string sliderValue { get; set; } public string logTime { get; set; } } } 提前感谢您您必
public class UserLogs
{
public Guid UserID { get; set; }
public string logData { get; set; }
public string sliderValue { get; set; }
public string logTime { get; set; }
}
}
提前感谢您您必须提供一个模板来告诉数据如何显示-这在
List<UserLogs> foundLogs = new List<UserLogs>();
foundLogs = (await firebaseClient
.Child("UserLogs")
.OnceAsync<UserLogs>()).Where(a => a.Object.UserID == userID).Select(item => new UserLogs
{
UserID = item.Object.UserID,
logData = item.Object.logData,
sliderValue = item.Object.sliderValue,
logTime = item.Object.logTime
}).ToList();
//list of logs being the name of the list view in the xaml file
ListOfLogs.ItemsSource = foundLogs;
<ListView>
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding UserID}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>