Click here to Skip to main content
15,885,038 members
Articles / Desktop Programming / Windows Forms

Extending the ListViewItem

Rate me:
Please Sign up or sign in to vote.
4.00/5 (4 votes)
14 May 2009CPOL6 min read 50.9K   928   28  
How to extend the ListViewItem to hold an object for a row, and map it to the columns in the ListView control.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ListViewExtendedItem
{
    public class ListViewColumnAttribute : Attribute
    {
        private string _columnName;

        public ListViewColumnAttribute(string columnName)
        {
            _columnName = columnName;
        }

        public override string ToString()
        {
            return _columnName;
        }
    }
}

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.

License

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


Written By
Software Developer
Romania Romania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions