change fore color of single cell in a datagrid

E

Erald Kulk

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
N

Nicholas Paldino [.NET/C# MVP]

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/
 
E

Erald Kulk

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top