StrataFrame Forum

color / listview

http://forum.strataframe.net/Topic31916.aspx

By Mimouni Mohamed - 3/15/2013

Hello,

How to display a color in the second column of a listview in the event RowPopulating

cordially
Mohamed Mimouni
By StrataFrame Team - 3/15/2013

The MicroFour.StrataFrame.UI.Windows.Forms.ListView does not support changing the background color of a single column by default.  We use standard System.Windows.Forms.ListViewItems for that list view, and the only way to change the background color on a column would be to implement OWNER_DRAW on the list view, which is a very involved process.

The MicroFour.StrataFrame.UI.Windows.Forms.StrataListView DOES support background colors on each of the individual sub-items (cells) in the list view.  It does not, however, have the same ListPopulationSettings as the standard ListView, so you would need to populate the list with the StrataListViewItems manually.  While you are building the list, you would set the background color on the column like this:

if (condition)
{
   strataListItem.SubItems[3].BackgroundColor = Color.Red;
}