Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

Disable/Disappear ListView Items

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RT - 27 Aug 2007 00:21 GMT
Is there any way to make Listview items invisible or otherwise keep
them from displaying?  Seems like temporarily removing, then restoring
later would be a severe runtime hit.
Peter Duniho - 27 Aug 2007 01:00 GMT
> Is there any way to make Listview items invisible or otherwise keep
> them from displaying?  Seems like temporarily removing, then restoring
> later would be a severe runtime hit.

Why does it seem like it would be a severe runtime hit?

Have you tried it?  Is it in fact a severe runtime hit?

Don't waste time optimizing prematurely.  It's simple enough to try just
removing things you don't want shown in the ListView, so try that first.
 If it works, great.  If not, _then_ you can worry about how to make it
faster.

For what it's worth, I suspect that removing/adding items is much _more_
performant than hiding.  When you remove something, it is simply not in
the ListView.  If you hide it, then every time the ListView draws, it
needs to know not to draw it, which is extra effort.  Since the drawing
happens much more often than the removing/adding, it's better to
remove/add items than keep checking to see whether they need to be drawn
(and of course, doing all the layout, etc. that results from changes in
the shown/hidden state).

Of course, all this is probably moot...I don't think that there is in
fact a way to leave something in the ListView items collection and yet
hide it.  But even if there were, I don't think performance would be a
reason to take advantage of that.

Pete
RT - 27 Aug 2007 06:41 GMT
>> Is there any way to make Listview items invisible or otherwise keep
>> them from displaying?  Seems like temporarily removing, then restoring
[quoted text clipped - 3 lines]
>
>Have you tried it?  Is it in fact a severe runtime hit?

The ListView lists info on files, so there could be thousands of items
at times. The goal is to set up 'filters' so that subsets can be
displayed.

Re runtime: I've tried some worst-case scenarios, and just adding the
items takes a while.

Also tried using swapping in a different ListView control using some
of the items pulled from the original ListView. Seems that you can't
use a ListViewItem more than once (damn) so I had to do bitwise
clones. Also time-consuming.

>For what it's worth, I suspect that removing/adding items is much _more_
>performant than hiding.  When you remove something, it is simply not in
>the ListView.  If you hide it, then every time the ListView draws, it
>needs to know not to draw it, which is extra effort.  

That's a good point. I thought that if the mechanism was there, that
maybe there would be some internal caching in place.

>Of course, all this is probably moot...I don't think that there is in
>fact a way to leave something in the ListView items collection and yet
>hide it.

Nothing like a dead end to guide coding strategy, eh? <g>

> But even if there were, I don't think performance would be a
>reason to take advantage of that.
>
>Pete

Unfortunately, it will perform poorly as it is too.
AlexS - 27 Aug 2007 12:03 GMT
How many items you add and how? Over 100K?
Could you post the code which is slow?

>>> Is there any way to make Listview items invisible or otherwise keep
>>> them from displaying?  Seems like temporarily removing, then restoring
[quoted text clipped - 36 lines]
>
> Unfortunately, it will perform poorly as it is too.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.