locked
listview column sum

    Question

  • hi

    i need listview item column sum in C# in windows store

    my list view name is Table and have 20 column.

    i need sum columns 6 and 8

    tanx


    Amir Ameri


    • Edited by AMIR ameri Thursday, December 04, 2014 10:00 AM
    Thursday, December 04, 2014 9:03 AM

Answers

  • If you need help you need to provide more information about what you are doing. Where does the data come from? What does your data model look like? How are you filling the ListView? Show what your code and xaml for this look like (if it's more than a few lines then share a minimal repro project on your OneDrive).

    Showing the contents of the ListView without explaining where they come from isn't enough information to explain how to sum up the column. As I explained previously this generally is done from the underlying data. If the code snippet I provided doesn't help then you need to explain clearly in what way it didn't help and what your specific needs are.

    • Marked as answer by AMIR ameri Friday, December 19, 2014 5:23 AM
    Friday, December 19, 2014 1:49 AM
    Owner

All replies

  • column 6+ column 8 ?

    you can sum them on data model before you bind it to listview.


    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

    Thursday, December 04, 2014 3:46 PM
  • for example I want sum column5

    my list view name is table.


    Amir Ameri

    Thursday, December 04, 2014 4:33 PM
  • i add ,insert and delete from lisy

    i want total sum have update every time i change it

    i need just sum column

    please help me about this

    what is code for sum column


    Amir Ameri

    Thursday, December 04, 2014 7:46 PM
  • hi

    i have a listview that have 3 column.

    i want total sum one column.

    how can i do it i c# and xamel.

    tank you very much.

    id       product      price 

    1          book         10

    2         pencil        3

    3         bag          25

    4         table        85

    ----------------------------

    Total Price : ??


    Amir Ameri

    Sunday, December 07, 2014 3:03 PM
  • Please don't post multiple threads on the same subject. Doing so loses context and will make it more difficult for people to provide answers.

    Also please provide more details about what you are doing. As Bill said, you'll need to sum this from the underlying data not from the ListView's presentation. You need to explain what you are already doing before anybody can provide a clear answer on how to sum the columns: where does the data come from? What does our data model look like? How are you filling the ListView?

    If you have a collection of data objects with a Price property then sum up that property.

    int price = 0;
    foreach (var item in DataObject)
    {
       totalPrice += item.Price;
    }

    Sunday, December 07, 2014 3:27 PM
    Owner
  • hi

    very sorry for it.i am beginner and i dont know some thing about this problem.

    i try  better.

    i have a list view.

    my list view have some columns(13 column)

    data value in this columns are int.

    my list view name is :TABLE

    my list view have some row.

    i want sum columns no 4 and put the result into a textblock.

    so i have 3 button that name is : Add  Insert and Delete 

    i have this column sum by this code to add button(TOTALWEIGTH +=  double.Parse(Vallweigth)).

    but when i delete a row from my list , sum result not update. (dont Subtraction)

    it is my problem.

    sorry if i can not explain better.my english language is not good :(


    Amir Ameri

    Sunday, December 07, 2014 4:18 PM
  • hi

    i have listview that name is table

    listview have 10 column and some row and row added by user.

    i want sum each column and put result to TOTAL textblock

    please say me how can do it?

    tank you very much


    Amir Ameri

    Sunday, December 07, 2014 8:57 PM
  • Please don't post multiple threads on the same subject. It is rude and does not encourage people to help you.

    If you need help you need to provide more information about what you are doing. Where does the data come from? What does your data model look like? How are you filling the ListView? Show what your code an xaml for this look like (if it's more than a few lines then share a minimal repro project on your OneDrive).

    Also please have some patience between posts. It may take some time before people will respond, especially when you post during the weekend US time (the main moderation team is in the US). Wait a day or two before you start to feel ignored.

    Sunday, December 07, 2014 11:43 PM
    Owner
  • oh my god

    my question is very simple!!!!

    why you said TO ME provide more information about what you are doing!!

    I HAVE A LIST VIEW THAT HAVE A COLUMN.I WANT TOTAL SUM FOR THIS COLUMN

    MY LISTVIEW NAME IS TABLE.

    PRICE

    34

    36

    67

    89

    65

    45

    34

    ==========

    TOTAL PRICE=??????

    JUST THIS


    Amir Ameri


    • Edited by AMIR ameri Monday, December 08, 2014 6:58 AM
    Monday, December 08, 2014 6:56 AM
  • If you need help you need to provide more information about what you are doing. Where does the data come from? What does your data model look like? How are you filling the ListView? Show what your code and xaml for this look like (if it's more than a few lines then share a minimal repro project on your OneDrive).

    Showing the contents of the ListView without explaining where they come from isn't enough information to explain how to sum up the column. As I explained previously this generally is done from the underlying data. If the code snippet I provided doesn't help then you need to explain clearly in what way it didn't help and what your specific needs are.

    • Marked as answer by AMIR ameri Friday, December 19, 2014 5:23 AM
    Friday, December 19, 2014 1:49 AM
    Owner