ListView Hang?

G

Guest

I copied the sort column code from the msdn to make the listview column
sortable.
(.net CF doesn't have the built in sort function.)
however when I click listview column header to make it sort, sometimes the
items in the listview sorted but hang. At that time, if I click the items in
the listview, nothing happened. If I click the program menu, the program
does not response. If I click listview header to sort it again, then
everything back to normal again.
It happens like 5 out of 100 times.

I used a timer(350ms) to update the items of the listview. Is it causing
this issue?
If yes, how to solve this issue?
I did try to use lock(object) to lock both related code in timer1_Tick() and
listview1_ColumnClick() but it seems doesn't help.

Any idea?
 
G

Guest

After I added listView1.EnsureVisible(0) at the end of the sorting code in
listView1_ColumnClick, ListView doesn't hang so far.

Does anyone know why it helps?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top