Click here to Skip to main content
12,557,291 members (49,689 online)
Click here to Skip to main content


52 bookmarked

An extendable ListViewSorter

, 12 Oct 2006 CPOL
This article describes how to sort a ListView ascending/descending with two lines of code, and how to extend its sorting capabilities.
<Project DefaultTargets="Build" xmlns="">
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Compile Include="ListViewItemComparer.cs" />
    <Compile Include="ListViewSorter.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <ProjectReference Include="..\Comparer\Comparer.csproj">
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  <Target Name="AfterBuild">

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Marcus Deecke
Software Developer (Senior)
Germany Germany
I am working for a small software company in Hamburg, Germany, and my day-to-day distress is Java development.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161026.1 | Last Updated 12 Oct 2006
Article Copyright 2006 by Marcus Deecke
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid