首页 > 代码库 > WP8.1开发中复杂JSON绑定数据时的方法

WP8.1开发中复杂JSON绑定数据时的方法

如果要绑定要一个集合中的另一个集合,比如这样的JSON:

 1   public class GetTransferInfo 2     { 3         public class Segment 4         { 5             public string Start_stat { get; set; } 6             public string End_stat { get; set; } 7             public string Line_name { get; set; } 8             public string Stats { get; set; } 9             public int Line_dist { get; set; }10             public int Foot_dist { get; set; }11         }12         public class Segments13         {14             public List<Segment> Segment { get; set; }15         }16         public class Bus17         {18             public int Dist { get; set; }19             public int Time { get; set; }20             public int Foot_dist { get; set; }21             public int Last_foot_dist { get; set; }22             public Segments Segments { get; set; }23         }24         public class Buses25         {26             public List<Bus> Bus { get; set; }27         }28         public class Data29         {30             public int Result_num { get; set; }31             public Buses Buses { get; set; }32         }33         34             public int Status { get; set; }35             public string Message { get; set; }36             public Data data { get; set; }                 37     }

 

这是前端XAML绑定时要这样写

Text="{Binding Segments.Segment[0].Start_stat}"

WP8.1开发中复杂JSON绑定数据时的方法