我有这个viewmodel为我提取数据。这很好用。 我需要的只是objProdList中的数据,我需要将它绑定到listview。
public class ProductDetailsViewModel : BaseViewModel
{
public IDataService DataService { get; private set; }
public CustomerProductList objProdList { get; set; }
public string Title { get; }
public ProductDetailsViewModel(CustomerSelectContainer custrecord)
{
//Pull the product list data by customer
//CustomerRecord = custrecord;
DataService = ServiceRepository.GetService<IDataService>();
objProdList = DataService.GetCustomerProductList(custrecord.Customer);
Title = "Product Details";
}
}
以下是customerProductList的模型 我只需要listview上的CustomerProducts数据
public class CustomerProductList
{
[BsonId]
public long CustomerProductListId { get; set; }
public Customer Customer { get; set; }
public List<CustomerProduct> CustomerProducts { get; set; } = new List<CustomerProduct>();
public CustomerProductList()
{
}
public CustomerProductList(Customer customer)
{
Customer = customer;
}
}
以下是客户产品模型的外观。
public class CustomerProduct
{
public string CustomerProductKey { get; set; }
public int LineNumber { get; set; }
public Product Product { get; set; }
public Price Price { get; set; }
public int RentalQuantity { get; set; }
public int CircInventory { get; set; }
public string DeliveryFrequency { get; set; }
public decimal MinimumUsePercentage { get; set; }
}
如何将objProdList.CustomerProduct绑定到我的xaml中的listview itemsource