更新时间:2023-11-28 23:08:16
您的Products类不应继承任何内容.
Your Products class shouldn't inherit anything.
public class Products
通过Product类的DataCollection属性完成对集合中所有项目的访问.例如,
Accessing all the items in your collection is done through the DataCollection property of the Product class. For example,
Products myProducts = new Products();
ObservableCollection<Product> myData = myProducts.DataCollection;
这还取决于您要如何使用产品.您也许可以完全取消此类,然后执行类似的操作:
It also depends on how you want to use Products. You may be able to totally do away with this class and then do something like:
ObservableCollection<Product> Products = new ObservableCollection<Product>();
Products.Add(new Product("Haystack Code Generator for .NET", 799, IMG_PATH + "Haystack.jpg"));
// etc...