Windows phone 8 Windows Phone 8 Json获取结果编号

Windows phone 8 Windows Phone 8 Json获取结果编号,windows-phone-8,Windows Phone 8,我正在创建WIndows Phone 8新闻应用程序,我希望在列表框之间插入不同的数据,如 if (result == 1){ Display Header with first item from Json }else{ Display Listbox From Secound Json data } 这是我的密码 public void getMainData() { string jsonUrl = "http://Domi

我正在创建WIndows Phone 8新闻应用程序,我希望在列表框之间插入不同的数据,如

if (result == 1){
    Display Header with first item from Json
}else{
    Display Listbox From Secound Json data
}  
这是我的密码

 public void getMainData()
        {

            string jsonUrl = "http://Domian.com/api.json";

            WebClient wc = new WebClient();
            wc.DownloadStringCompleted += wc_DownloadStringCompleted;
            wc.DownloadStringAsync(new Uri(jsonUrl ));
           }


        void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                string result = e.Result.ToString();
                JsonConvert.PopulateObject(result, PopulateData);
                NewsList.ItemsSource = PopulateData;           
            }
我是C的新手,有人能帮我吗
非常感谢

也许是这样的:

public void getMainData()
{
    string jsonUrl = "http://Domian.com/api.json";

    var result = (new HttpClient()).GetStringAsync(jsonUrl);
    var data = JsonConvert.DeseralizeObject(result);

    for(int i = 0; i < data.Count(); i++)
    {
        if(i % 3 == 0)
        {
            // add banner
            var bannerGrid = new Grid();

            NewsList.Items.Add(bannerGrid);
        }

        // add the news
        var itemGrid = new Grid();
        itemGrid.Children.Add(new TextBox()
        {
            Text = data[i];
        });
        NewsList.Items.Add(itemGrid);
    }    
}
上面的代码可能无法编译。我用记事本++写的。但你应该了解它是如何工作的


代码正在使用HttpClient。NuGet上提供了它。

非常感谢,我插入了标题图像和标题,但标题和列表框的第一项与标题相同。如果==0,则显示第一项,否则显示列表框以我想要的第二项开始。怎么样possible@kakkuk你能把它添加到你的问题中,并用更好的措辞表达吗?我编辑并插入了示例照片。非常感谢您是否希望第一个项目有不同的模板?是的。以及头和列表框的第一个数据,使用右侧SECOND数据启动。我使用了Telerik RadDataBoundListBox和ListHeaderContentOk。你能设置一个ListHeaderTemplate吗?每件事都很好,代码也在工作,但第一个标题数据和第二个查找数据现在是一样的,只是我希望Listbox以第二个计数数据开始