如何用列表填充 Xamarin Android 的 Sf DataGrid (Syncfusion)?
how to fill a Sf DataGrid (Syncfusion) of Xamarin Android with a List?
我一直在尝试用returns的方法来填充网格,但是我做不到,你能帮帮我吗?
public void Rest()
{
RestClient client = new RestClient("http://URLWEBAPI");
var request = new RestRequest("GetData", Method.GET);
request.Timeout = 300000;
request.RequestFormat = DataFormat.Json;
request.AddParameter("Del",btnDel.Text);
request.AddParameter("Al", btnAl.Text);
//request.AddParameter("llaveEmp", llaveEmp);
request.AddParameter("id", id);
var temp = client.Execute<List<string>>(request).Data;
dataGrid.ItemsSource = temp;
dataGrid.RefreshDrawableState();
}
感谢您使用 Syncfusion SfDataGrid 控件。
我们已经检查了您的查询,我们的 SfDataGrid 控件将同时支持 List 和 ObservableCollection。您可以从下面 link 获取 Xamarin.Android 的 SfDataGrid 演示:
http://www.syncfusion.com/downloads/support/directtrac/189152/ze/DataGrid_GettingStartedAndroid1162477819
如果在SfDataGrid中使用JSON数据绑定,那么我们必须将JSON数据反序列化为可绑定的格式,因为不能直接绑定JSON到SfDataGrid。请参阅以下知识库文章 link 以获取有关 Xamarin.Android 中包含 JSON 数据的 SfDataGrid 填充的更多详细信息:
https://www.syncfusion.com/kb/7827/how-to-populate-sfdatagrid-with-json-data
如果您的要求与此不同,请分享您的样品或有关您的要求的更多详细信息,这将有助于我们进一步进行。
此致,
阿肖克
我一直在尝试用returns的方法来填充网格,但是我做不到,你能帮帮我吗?
public void Rest()
{
RestClient client = new RestClient("http://URLWEBAPI");
var request = new RestRequest("GetData", Method.GET);
request.Timeout = 300000;
request.RequestFormat = DataFormat.Json;
request.AddParameter("Del",btnDel.Text);
request.AddParameter("Al", btnAl.Text);
//request.AddParameter("llaveEmp", llaveEmp);
request.AddParameter("id", id);
var temp = client.Execute<List<string>>(request).Data;
dataGrid.ItemsSource = temp;
dataGrid.RefreshDrawableState();
}
感谢您使用 Syncfusion SfDataGrid 控件。
我们已经检查了您的查询,我们的 SfDataGrid 控件将同时支持 List 和 ObservableCollection。您可以从下面 link 获取 Xamarin.Android 的 SfDataGrid 演示: http://www.syncfusion.com/downloads/support/directtrac/189152/ze/DataGrid_GettingStartedAndroid1162477819
如果在SfDataGrid中使用JSON数据绑定,那么我们必须将JSON数据反序列化为可绑定的格式,因为不能直接绑定JSON到SfDataGrid。请参阅以下知识库文章 link 以获取有关 Xamarin.Android 中包含 JSON 数据的 SfDataGrid 填充的更多详细信息:
https://www.syncfusion.com/kb/7827/how-to-populate-sfdatagrid-with-json-data
如果您的要求与此不同,请分享您的样品或有关您的要求的更多详细信息,这将有助于我们进一步进行。
此致,
阿肖克