public Form1() { InitializeComponent(); Product product = new Product(1, 1, "name1", "brand1", 1d, 2.5d, "supplier1", "123456", "8718123456721", new ProductGroup(1, "group1", new ProductCategory(1, "category1"))); var item = new ProductListViewItem(product); listView1.Items.Add(item); }
private void showSelectedItem(ProductListViewItem itemToShow) { lblProduct.Text = itemToShow.product.name; lblBrand.Text = itemToShow.product.brand; nudAmount.Value = itemToShow.amountOfProduct; nudAmount.Enabled = true; btnRemove.Enabled = true; }
private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (e.IsSelected) { selectedProduct = (ProductListViewItem)e.Item; showSelectedItem(selectedProduct); } else { selectedProduct = null; clearSelectedItem(); } }