Alternate background color for column with TableStyle / GridColumnStyle
-
Hi, I have a datagrid that needs to show different columns with different widths. So I use TableStyles and GridColumnStyles, no problem. There are approximately 12 columns, three of which I need to visually jump out. So I figure I'll just make the font for these columns bold, or better yet, change the background color for these three columns only. But there is neither a font nor a background color property in the GridColumnStyle. Apparently I just don't know what to ask for in google, or I am the only person in the world who needs differently colored columns, because all I found was ways to change the background color and/or font of a cell / column when it is activated / clicked on / entered. Any suggestions at all appreciated. Johan
My advice is free, and you may get what you paid for.
-
Hi, I have a datagrid that needs to show different columns with different widths. So I use TableStyles and GridColumnStyles, no problem. There are approximately 12 columns, three of which I need to visually jump out. So I figure I'll just make the font for these columns bold, or better yet, change the background color for these three columns only. But there is neither a font nor a background color property in the GridColumnStyle. Apparently I just don't know what to ask for in google, or I am the only person in the world who needs differently colored columns, because all I found was ways to change the background color and/or font of a cell / column when it is activated / clicked on / entered. Any suggestions at all appreciated. Johan
My advice is free, and you may get what you paid for.
you have to do the drawing yourself by deriving from datagridtextboxcolumn and then overriding the paint-method. i found this c#-article being helpful: Changing the background color of cells in a DataGrid[^]
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
-
you have to do the drawing yourself by deriving from datagridtextboxcolumn and then overriding the paint-method. i found this c#-article being helpful: Changing the background color of cells in a DataGrid[^]
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
I owe you my gratitude ! I can't say I have it figured out completely yet, but you have certainly managed to point me in the right direction, and given me a little push to boot, thanks. Johan
My advice is free, and you may get what you paid for.