Hello friends, I've been working on a program that extracts the data from a database, then when I query the database the data is displayed on a listview, and then only the items that are selected are added into another listview(checkbox), now my problem is that i need to calculate the total price of the items, in the last listview the headers are items and price, so i need when i click in a button all the data displayed on the column price get sumarized.
This is my code, i have tried usinglistview.items[].subitems[]; but it seems that it no longer exists.
This is the code that add the selected items in the main listview to the checkout listview:
private void lstData_MouseDoubleClick(object sender, MouseButtonEventArgs e)//Add item to lstCart with DoubleClick
{
lstCart.Items.Add(lstData.SelectedItem);
}
And this is the code that i tried to use to get the data from the listCart
ListView.SelectedItemProperty precio =
this.lstData.SelectedItems;
double price = 0.0;
foreach (lstCart.SelectedItem in precio)
{
price += Double.Parse(item.SubItems[1].Text);
}
//Output the price to TextBox1.
TextBox1.Text = price.ToString();
BTW i'm using WPF with VS Studio 2010
Thanks in advanced!