Hi,
I have a wingrid that is bound to a hierarchical dataset (3 bands). Based on user interaction, I may change the background color of a bunch of rows in a given band, AND/OR individual cells.
I want to be able to reset back to the original untampered background colors, quickly and efficiently. How might I do this?
Code snippet for the highlighting is as follows...how do I reverse the changes!!!
row.appearance.backcolor = color.crimson '// highlighting a row.
row.rowselectorappearance.backcolor = color.green
row.childbands(0).Rows(0).Appearance.backcolor = Color.blue
row.Cells(field).Appearance.BackColor = Color.Aquamarine
TIA
What's no logical about it? Seems perfectly logical to me. And your method of storing the cells in a List and then iterating them is a lot more efficient than my suggestion. :)
Hello skavan,
I believe that the way you are doing this is good enough and am wondering why do you feel worried.
Please do not hesitate to ask if something comes up.
well..might try your version....but figured out the following workaround.
everytime I apply an appearance to a row or a cell, I add that row or cell to my own collection.
I then iterate through the collections and fire:
row.RowSelectorAppearance.ResetBackColor() row.Appearance.ResetBackColor()
cell.Appearance.ResetBackColor()
It doesn't seem that logical! Is there a better approach to highlighting and resetting appearances?
If you are applying an appearance to a row, then the only way to remove that appearance is to reset the Appearance on that same row object.
Typically, what you would do is use the InitializeRow event for this. This event fires when the row is initialized and also whenever any values in the row changes.
When you want to turn off the appearances, you would set a flag, then call grid.Rows.Refresh(FireInitializeRow). This causes the event to re-fire for every row. You can check the flag and when it's true, you reset the Appearance instead of applying it.