-2
我正在編寫一個Windows Phone 8.1應用程序(WINRT)。System.ArgumentException:值不在預期的範圍內。在WindowsPhone應用程序
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:值不在預期範圍內。