locked
Handling listviews in wpf RRS feed

  • Question

  • Hi,        i have a requirement  in a wpf app ,that to handle two listviews which have gridview in it

    at runtime i filled a listview from database ,one selecting listview1 and press addbutton the selected value should remove from listview1 and add to listview2, there is removebutton also there, how can i handle all these operations using a single temptable,  ie    in temptable insert a column  with values 0,1 selected rows in listviews set to 1  and remainig are 0 . how can i bind this table to both listviews based on inserted column values 

    Thursday, September 2, 2010 6:20 AM

Answers

  • Hi Mp ganesh,

    I think you need to have a List or ObservableCollection of the a class that contains a flag (0, 1) that determines the selected or not (on listbox1 or listbox2).  Then you will have a 2 properties that will return the correct list based on flag (either using linq or lambda).

    Then bind these properties to your separate lisboxes.

    when adding/removing, just update the property flag (0 or 1) to change.

     

    Hope this helps.

    Regards,

    gioVhan


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Proposed as answer by Min Zhu Monday, September 6, 2010 4:30 AM
    • Marked as answer by Min Zhu Wednesday, September 8, 2010 1:30 AM
    Thursday, September 2, 2010 7:45 AM