So, i have a list view, and i want to add all of the decimals inside of the listview and display the total in a label.
Ideally i want the total (in the label) to be updated each time the listview is updated. But right now i just want a working total to be displayed in the label.
Since im working in WPF the SubItems doesnt work, i've tried looking for the solutions around it but i get completely overwhelmed by what i find.
I've tried this.
private void Button_Click_1(object sender, RoutedEventArgs e)
{
decimal total = 0;
foreach (ListViewItem lstViewItem in orderDetailsListView.Items)
{
foreach (ListViewItem o in orderDetailsListView.Items)
total = total + Convert.ToDecimal(orderDetailsListView.Items.["Price"].Text);
totalOutputLabel.Content = total;
}
}
But it doesnt work, because an identifier is expected here...Items.
["Price"]
I know its so simple and can be done in no time, but i've searched and search and every solution i have come across, is either VB, winforms, datagrids and the rare chance i find a solution for mine, it doesnt work due to parts of their code not being the same as mine.