Manipulating ListView C #

2

I have a ListView that displays the data on the screen and has multiple rows and columns. For example:

      Cl1 | Cl2 | Cl3
  L1  aa  | bb   |  cc
  L2  ab  | bc   |  cd
  L3  ac  | bd   |  ce

I would like to know if you have some native C # function (type: lambda, LINQ, etc), to search and change the values in the ListView? For example: Search for 'ab' (Cl1, L2), and change 'cd' (Cl3, L2) to 'test'.

    
asked by anonymous 03.12.2014 / 21:09

1 answer

3

In theory, you can extract Items and iterate it as a list:

var lista = minhaListView.Items;

Then you can search like this:

var elemento = lista.FirstOrDefault(l => l.nome == "Fulano");

Changing:

elemento.nome = "Beltrano";

Or, to access a particular line (consider position 0 as the first element for the list):

var elementoNaTerceiraLinha = minhaListView.Items[2];
    
03.12.2014 / 21:20