true, however there are implementation for binding to listview.
http://www.codeproject.com/cs/miscctrl/ListView_DataBinding.asp is a nice
example.
Sorry I was unclear:
Databinding has nothing to do with my question. As Nicholas points out, the
ListView is not databindable, and even if it was, it would still not solve
my problem. I'm looking for a way to do this without databinding.
As for Ignacios suggestion about remembering the items index, it's an idea,
but a very complex one. If it was only ONE item that was temoved, it
wouldn't be a problem, but now were talking about an undefined number
between 0 and all items. So when I want to reinsert an item, I have to
iterate through ALL the items that are in the Listview to find out which
Items i should insert my item between. And the items that are left in the
listview doesn't have their origianl indexes anymore, so i would be forced
to match all the items with a table of the original indexes.
I can write the code for that, but all solutions I can see are going to take
time, thus affecting performance during the filtering process.
I guees I hoped that somebody would have a magical solution... ;-)
Cheers,
Johnny
> true, however there are implementation for binding to listview.
>
[quoted text clipped - 30 lines]
>>>> the one that you bind to the control, when you need to change it you
>>>> simply do it again.
Nicholas Paldino [.NET/C# MVP] - 26 Sep 2007 21:44 GMT
Johnny,
I don't think that noting the indexes of the items that are filtered out
is that big of a deal. If you cycle through the list items, and remember
the zero-based indexes of the items that are removed (along with the items),
then you can iterate through that list of items that was removed again, and
call Insert on the Items collection with that index. You just have to make
sure that as you iterate through the removed items, the index that you are
inserting at is incrementing.
Every time you call Insert, it will arrange the items between the insert
point and the next insert point so that they are in the correct position.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> Sorry I was unclear:
>
[quoted text clipped - 53 lines]
>>>>> the one that you bind to the control, when you need to change it you
>>>>> simply do it again.
Ignacio Machin ( .NET/ C# MVP ) - 27 Sep 2007 21:11 GMT
Hi,
> As for Ignacios suggestion about remembering the items index, it's an
> idea, but a very complex one. If it was only ONE item that was temoved, it
[quoted text clipped - 4 lines]
> listview doesn't have their origianl indexes anymore, so i would be forced
> to match all the items with a table of the original indexes.
> I can write the code for that, but all solutions I can see are going to
> take time, thus affecting performance during the filtering process.
>
> I guees I hoped that somebody would have a magical solution... ;-)
It's not that complex, and you can implement it and share with the rest of
us :)