Add BackColor/ForeColor properties to the ListView columns


Author
Message
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
I would be really nice to be able to change column colors for the listview.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Are you referring to the header or the area where the text is?  If you are referring to the text area, there is a new event called the RowPopulated (instead of RowPopulating) that gives you the entire column, list item ,etc.  So you could actually do this.

But here is a little sneak peek of something coming down the pike.  It won't be in the next release (but there may be some other goodies Wink ), but here is a StrataListView that will ultimately replace the current ListView.  The StrataListView is 100% written from scratch and so there will be a lot more flexibility.  But this is something fun to look forward to BigGrin

Notice that it will follow theme colors!  This will be in our medical app for a while before we release it...like we do most controls.  But once we work through the process it will make it into the framework.

Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (06/04/2009)
Are you referring to the header or the area where the text is? If you are referring to the text area, there is a new event called the RowPopulated (instead of RowPopulating) that gives you the entire column, list item ,etc. So you could actually do this.


Super, could you provide a quick sample code on how to change the backcolor of a column?



But here is a little sneak peek of something coming down the pike. It won't be in the next release (but there may be some other goodies Wink ), but here is a StrataListView that will ultimately replace the current ListView. The StrataListView is 100% written from scratch and so there will be a lot more flexibility. But this is something fun to look forward to BigGrin


That is just awesome, can't wait to get this in the framework.


Edhy Rijo

Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent,



In case you missed my response above, could you please provide a quick sample code on how to change the backcolor of a column in the ListView? I have tried different code and none worked.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I was thinking the row, not the column. If you want to render the column, you will have to do an owner draw, which means you have to render all columns. It isn't that hard, but it will definitely be more work than just setting a property. This is something that will be in the future StrataListView control. Adding this logic to the existing ListView would require an entire Owner draw...thus using the new control would be more logical. Sorry Unsure
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (06/05/2009)
I was thinking the row, not the column.


I understand. Could you elaborate why would be use the RowPopulated instead of the RowPopulating?

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
In short, it exposes the entire ListView Item so you can set anything on it you like such as the fore color, back color, etc.  You are given direct access to the ListViewItem properties.  That is really the only purpose.
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (06/05/2009)
... If you want to render the column, you will have to do an owner draw, which means you have to render all columns. It isn't that hard, but it will definitely be more work than just setting a property. This is something that will be in the future StrataListView control. Adding this logic to the existing ListView would require an entire Owner draw...thus using the new control would be more logical. Sorry Unsure




I am really in the need to add BackColor to a couple of columns in a several ListView, do have any sample or reference code that I may use as start point to try to get this done?

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
There are a ton of them out on the web. Just search for ListView and OwnerDraw:



http://www.codeproject.com/KB/list/EXListView.aspx



http://www.experts-exchange.com/Programming/Languages/.NET/Q_20872868.html



This is just a function of the standard .NET ListView and handling that event. In the event you will be given the bounds, column and row information then you just render as you require. This does require some effort. This is also something that we do not intend to change on the existing ListView as it would require a lot of effort to make this a "global" resolution and our efforts would be better served on the new StrataListView control.
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Thanks.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search