By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,338 Members | 1,346 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,338 IT Pros & Developers. It's quick & easy.

change fore color of single cell in a datagrid

P: n/a
L.S.

in a datagrid I would like the forecolor of a single cell. Because it
is a negative number. This cannot be done by changing the NumberFormat
property.
So how can I do this??

Erald
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Erald,

This is difficult with the current DataGrid. The reason is that
determining how to render contents on the grid is done on a per-column
basis. Because of this, you would have to create a class that derives from
DataGridColumnStyle and then handle the rendering of the background color
based on the value.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Erald Kulk" <er***@delta-travel.nl> wrote in message
news:d9**************************@posting.google.c om...
L.S.

in a datagrid I would like the forecolor of a single cell. Because it
is a negative number. This cannot be done by changing the NumberFormat
property.
So how can I do this??

Erald

Nov 13 '05 #2

P: n/a
Erald,

Honestly, I do think that it is the wrong way (the way they implemented
it). I think that there are third party controls out there which do a much
better job. One of the ones I like is the grid from Xceed software. You
can find more information about it at:

http://www.xceedsoft.com/products/GridNet/
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Erald Kulk" <an*******@devdex.com> wrote in message
news:eD**************@tk2msftngp13.phx.gbl...


Nicholas Paldino,

thank you for your answer. I will have to figure out how to derive the
class correctly, but I think I'll manage.
Quite strang it is that complicated, but that's probably too
philosophical.

Erald Kulk

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #3

P: n/a
thank you for the advise. By extending the DataGridColumnStyle and
changing the overridden pain method I created the datagrid I intended
to have. New problem. This column has an expression to calculate its
values. But this generates an error when saving. cannot change the
readonly property of the expressioncolumn. or something like that. I
got the error in dutch.

anybody any idea?

Erald Kulk
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.