private List <UserSalesBox> PopulateProducts(List <Product> startProductsList) { List <UserSalesBox> _uAB = new List <UserSalesBox>(); foreach (var item in startProductsList) { UserSalesBox _u = new UserSalesBox { ProductName = item.ProductName, Description = item.Description, Price = item.Price, TopLeft = item.Price.ToString(), TopRight = item.Price.ToString(), ProductType = item.ProductType, BottomLeft = "Info", BottomRight = "Info", BottomCenter = "BUY NOW", ProductPicture = DataAccess.ImageSourceToBytes(new PngBitmapEncoder(), DataAccess.ToBitmapImage((Bitmap)Properties.Resources.ResourceManager.GetObject(item.Picture))), Width = 200, Margin = new Thickness(25, 25, 25, 25) }; // _u.SalePicture = DataAccess.ImageSourceToBytes(new PngBitmapEncoder(), DataAccess.ToBitmapImage((Bitmap)Properties.Resources.ResourceManager.GetObject("i_Sale"))); _uAB.Add(_u); } return(_uAB); }
internal void FillSalesBoxes() { for (int i = 0; i < 8; i++) { UserSalesBox _p = new UserSalesBox().Fill(i); productList.Add(_p); } lstProducts.ItemsSource = productList; lstProducts.Items.Refresh(); lstProducts.SelectedItem = -1; }