[Mono-winforms-list] [PATCH] ListView sorting fixes

Gert Driesen gert.driesen at telenet.be
Thu Aug 31 14:05:13 EDT 2006



> -----Original Message-----
> From: Mike Kestner [mailto:mkestner at novell.com]
> Sent: donderdag 31 augustus 2006 18:41
> To: Gert Driesen
> Cc: mono-winforms-list at lists.ximian.com
> Subject: Re: [Mono-winforms-list] [PATCH] ListView sorting fixes
> 
> On Tue, 2006-08-29 at 21:42 +0200, Gert Driesen wrote:
> 
> > The bugs I came across in MS.NET are:
> > - .NET 1.1: once set, modifying Sorting does not have any effect for
> > SmallIcon and LargeIcon views unless a custom IComparer is set. This
> > is fixed in .NET 2.0.
> > - .NET 2.0: setting Sorting to None also discards the custom
> > IComparer, if set.
> 
> Heh.  Nice detective work.  We might as well maintain bug compat on
> this stuff.
> 
> > Is it ok to send patches to this list or should they go to the
> > devel-list ?
> 
> This list is fine for patches.
> 
> This is beautiful work.  Thanks for providing such a detailed test
> suite in addition to the code.
> 
> Comments:
> 
> - Considerable whitespace change in the beginning of the patch.  Please
> try to remove as much of that as possible.

Done.

> - Test bug79076 never Asserts or has no Exception expected attr.  What
> is it testing?

Before the fix for bug #79076, that code used to result in an InvalidOperationException.

> - In the ItemComparer, the coding standard for fields would indicate
> 'sort_order', not '_sortOrder'.

Ok, I'll modify this. Can you send me a link to that coding standard ?

> - AFAICT, the two instances where Sort (false) occurs are immediately
> followed by a call to Redraw.  So other than the overloading conflict
> issue is there a reason for the redraw parameter on that new Sort
> overload?

What the Sort (bool) overload is called from Sort (), redrawing is only necessary if sorting was actually performed.

I'm not sure if you really want to force a redraw from ListViewItemCollection.Add and ListViewItemCollection.AddRange, if not we can just remove the Sort (bool) overload and the explicit Redraw calls from ListViewItemCollection (as the listview will be redrawn in Sort () if sorting is performed).

I'll look into your request for additional selection unit tests, and post an updated patch when ready.

Gert



More information about the Mono-winforms-list mailing list