我有以下模型:public class TableData{ [JsonProperty(PropertyName = "objectsDetected")] public List<ObjectsDetected> ObjectsDetected { get; set; } [JsonProperty(PropertyName = "file_name_at_upload")] public int File_Name_At_Upload { get; set; }}public class ObjectsDetected{ [JsonProperty(PropertyName = "className")] public string className { get; set; } [JsonProperty(PropertyName = "score")] public double score { get; set; }}我从一个api调用获取我的数据: var request = (HttpWebRequest)WebRequest.Create("http://localhost:58941/api/data"); request.Method = "GET"; request.ContentType = "application/json"; WebResponse response = await request.GetResponseAsync(); if (response != null) { string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); List<TableData> myDeserializedObjList = (List<TableData>)JsonConvert.DeserializeObject(responseString, typeof(List<TableData>)); cosmosData.ItemsSource = myDeserializedObjList; }这是XAML代码: <StackPanel> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="200"/> <ColumnDefinition Width="200"/> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Text="Navn på billede" Foreground="Black" FontSize="20" FontWeight="Bold"/> <TextBlock Grid.Column="2" Text="Kategori fundet" Foreground="Black" FontSize="20" FontWeight="Bold"/> </Grid> <GridView x:Name="cosmosData" ItemClick="cosmosData_ItemClick" IsItemClickEnabled="True" IsSwipeEnabled="true" SelectionMode="Single"> <GridView.ItemTemplate> <DataTemplate x:DataType="local:TableData">我想在同一表中的用户界面TableData和ObjectsDetected.classname中显示,但是我无法访问ObjectsDetected.classname?我怎样才能做到这一点?
1 回答
- 1 回答
- 0 关注
- 133 浏览
添加回答
举报
0/150
提交
取消