public void GetProductImage(string productid, int supplierid) { StudioMProductImage.Clear(); BitmapImage bi; client = new SQSAdminServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint); DataSet ds = client.SQSAdmin_StudioM_GetProductImages(productid, supplierid); client.Close(); foreach (DataRow dr in ds.Tables[0].Rows) { ProductImage b = new ProductImage(); b.ImageID = int.Parse(dr["id_StudioM_ProductImage"].ToString()); b.ImageName = dr["imagename"].ToString(); b.SupplierBrandName = dr["supplierbrandname"].ToString(); b.ImageStream = (byte[])dr["image"]; bi = new BitmapImage(); bi.BeginInit(); bi.StreamSource = new MemoryStream(ResizeImages((byte[])dr["image"], ThumbnailWidth, ThumbnailHeight)); bi.EndInit(); b.BMPImage = bi; StudioMProductImage.Add(b); } }