我正在编写 Windows Phone 8.1应用程序(WINRT)。
else if (GetProductByCategoryResultObject.Status == "1") //status is 1
{
//TODO:
//ProductsListingObject
ListView ProuctListView = new ListView();
ProductsListing ProductsListingObject = new ProductsListing();
for (int i = 0; i < GetProductByCategoryResultObject.Products.Count;i++ )
{
ProductsListingObject.ProductsListingLabel.Text = GetProductByCategoryResultObject.Products[i].ProductName;
if (GetProductByCategoryResultObject.Products[i].ProductThumbnail != null || GetProductByCategoryResultObject.Products[i].ProductThumbnail != "")
{
ProductsListingObject.ProductsListingImage.Source = new BitmapImage(new Uri(GetProductByCategoryResultObject.Products[i].ProductThumbnail,UriKind.Absolute));
}
ProuctListView.Items.Add(ProductsListingObject);
}
Grid GridObject = new Grid();
GridObject.Children.Add(ProuctListView);
(MainPagePivot.SelectedItem as PivotItem).Content = GridObject;
}
如果 GetProductByCategoryResultObject.Products.Count (产品数量)为1,那么应用程序运行正常。但如果计数超过1.它给我错误: {System.ArgumentException:值不在预期范围内。
答案 0 :(得分:0)
io.Writer