You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I'm aware that an SVG icon will typically replace the #000000 colour with a control's ForeColor in Wisej, for example in a button.
I'm trying to acheive the same thing in a DataGridView with little success.
I'm setting the cell Value to the image source and then setting the cell style to have a ForeColor, but the icon does not change.
Is this a supported behaviour in the DataGridView ?
If so what am I missing ?
I have tried the same code you posted and it works fine for me, the color changed to red. What build of Wisej are you using? There was a bug about this few builds ago.
Also, when processing CellValueNeeded the caching of the values is up to the code (you). In Virtual mode the datagrid doesn't store the value of the cells anywhere. So CellValueNeeded is fired every time the grid needs the value of the cell, which can be hundreds or thousands of times. If you create a new style object every time you end up creating a lot of instances that the GC will have to collect at some point.
Activity
itg-assistant commentedon Jun 12, 2026
Frank (ITG) answered 2017-09-21 11:53:22 UTC
Hi Andi,
you can simply add the color name after the imagesource, e.g.
e.Value = "icon-new?color=red";
See our documentation for more details and samples:
http://wisej.com/docs/html/Images.htm
Best regards
Frank
itg-assistant commentedon Jun 12, 2026
Andi Gordon answered 2017-09-21 13:59:00 UTC
Perfect. That worked :)
Thank you.
itg-assistant commentedon Jun 12, 2026
Luca answered 2017-09-21 15:34:42 UTC
Hello Andi,
To add to Frank's tip to use ?color (see also https://docs.wisej.com/docs/controls/general/icons).
I have tried the same code you posted and it works fine for me, the color changed to red. What build of Wisej are you using? There was a bug about this few builds ago.
Also, when processing CellValueNeeded the caching of the values is up to the code (you). In Virtual mode the datagrid doesn't store the value of the cells anywhere. So CellValueNeeded is fired every time the grid needs the value of the cell, which can be hundreds or thousands of times. If you create a new style object every time you end up creating a lot of instances that the GC will have to collect at some point.
HTH