views:

287

answers:

3

I'd like to change the BackgroundColor of a ListViewSubItem in a ListView in Windows Mobile. I'm using the Compact Framework ListView, whose ListViewItems only allow setting the BackColor on the entire row, which I don't want.

I have two questions:

  1. Is this possible?
  2. If this is possible, I know I have to P/Invoke to get this to work (because ListView.ListViewSubItem only offers a Text property), or send the right Windows message. What's the right function to call, or the right message to send?

Even just a pointer in the right direction would be appreciated.

A: 

My guess is that you need to draw the list view item yourself; use the default painting for the main item and do what you want for the subitem, MSDN example here, or something like that.

Johann Gerell
A: 

try to enable owner-draw true.. and set your own colour at drawingitem.. you wil get bounds.. draw your own colour

Shadow
Technically the ListView in CE would be custom drawn, not owner drawn, and the CF ListView doesn't support either one.
ctacke
yes.. you are exactly right, if you are using custom drawn then set owner-draw propertie true, and draw corresponding cell color there.for more info see this controleyou can use this controlehttp://code.msdn.microsoft.com/uiframework/Release/ProjectReleases.aspx?ReleaseId=2315
Shadow
+1  A: 

Christian Helle shows how to custom draw CF ListViews here.

ctacke