C# - Common way to format listview controls on forms?

Posted by John M on Stack Overflow See other posts from Stack Overflow or by John M
Published on 2010-04-07T15:01:42Z Indexed on 2010/04/07 15:03 UTC
Read the original article Hit count: 165

Filed under:
|
|

In a C# Winform application (3.5) there are numerous forms each with different listview controls. While each listview control uses different datasets the basic formatting of each remains the same.

Basic formatting takes this form:

  /* appearance */
  this.lstA.View = View.Details;
  this.lstA.AllowColumnReorder = true;
  this.lstA.CheckBoxes = false;
  this.lstA.FullRowSelect = true;
  this.lstA.GridLines = false;
  this.lstA.Sorting = SortOrder.Ascending;

What I would like to do is create a class that can be used to set the initial format of the listview.

How do I pass the listview (by reference?) to the class so that the appearance properties can be set?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms