[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1550
  • Last Modified:

Hide rows in a ListView.

Hi there,

I have a ListView on my WinForm, the view has 7 columns, and usually 1000+ rows, I want to be able to filter my view by any of the columns, and at present I can do this by removing the rows (ListViewItems) which aren't a match to my filter. The problem I have is that when I reset my filters (so, returning to the full set of data) I have to reload in my source to the view.

Is there any way to achieve this without having to reload my dataset?

I'd like to just 'hide' the incorrect items, and then show them again later, to ensure I don't loose the ordering.

Cheers

Wint.

By-the-by: I'm open to any other solutions to this problem that will minimise the reload side of things!
0
WinterMuteUK
Asked:
WinterMuteUK
  • 3
  • 3
1 Solution
 
AgariciCommented:
you should consider using a datagrid
a datagrid has something named 'RowFilter' which i bet will do the trick
also a datagrid is more suitable for working with large amount of data
and is more customizable...

where do you keep the 1000+ rows?
i bet you use a dataset/datatable
with a datagrid you can assign that table to the datasource property and you dont have to add the items in the list manually

hth,
A.
0
 
WinterMuteUKAuthor Commented:
Having never used the datagrid control does it provide the same level of 'changeable' features - colours etc that ListView provides, and in the same way?  (i.e. just properties of each row), I want each row to be able to be different colours/fonts etc which the listview allows.

The rows are dynamically generated as part of a larger systems debug log, currently it is written to a delimited file, but yes it is envisaged in the future to move to a database store.

Cheers

Wint.
0
 
AgariciCommented:
it is possible to color each row differently but not the way a listview does.
with datagrids you have to derive from datagridcolumnstyle (if i remember correctly the name) class and draw the row background with the colour you want

datagrids are very different from listviews but you can do with them what ever you want. they are designed to handle large amounts of data. and they can handle relations between data in the dataset.

A.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
WinterMuteUKAuthor Commented:
It's not the row background that I particularly want to be changed, it specifically needs to be the forecolour and font of the line that needs to be displayed. And it's specifically the rows, not columns that are required to be highlighted (unless I misunderstand what the DataGridColumnStyle does to a datagrid - in which case sorry!).

Imagine I have my grid filled with 1000 rows, can I then right click on row 400, select the Lastname of the person there and say 'Highlight all rows with the same last name as this in Red, with bold font'?

Cheers

Wint.
0
 
AgariciCommented:
yes, that can be realized like i said.

see this link
http://msdn.microsoft.com/smartclient/community/wffaq/ctrlsp.aspx#qxwzz7xj

you have there something called "How do I color a cell in a DataGrid depending upon its value or some external method?"

hth,
A.

0
 
WinterMuteUKAuthor Commented:
Great that solves some of the problems.

thanks very much
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now