I have a grid that is informational only. Based on other entries on the form, I'm coloring individual cells in the grid to hightlight issues with the data. This all works great, EXCEPT, the active row appearance messes up my pretty cell coloring.
So in effect what I want is for the activerow to have NO formating whatsoever.
I have tried transparent, but that seem to just bring through the Grid background color.
I can capture the row color in the BeforeRowActivate and set the ActiveRowAppearance so that all of the cells have the same back color.
But I CANNOT seem to control each cell in the ActiveRow appearance seperately.
I'm looking for something like ActiveRowAppearance = DO NOT CHANGE or USE INACTIVE ROW APPEARANCE...
Thoughts?
Dan
FAQ:How do I turn off the ActiveRowAppearance so that the active row in the grid does not appear selected.
Yeah I read that article. And I tried to get it to work. But nothing I tried worked. I'm setting this grid up in code and so I'm trying not to use the designer to do anything on the grid. So when I read that article, I did a .activerowappearance.reset. Still had a blue selection background. There does not seem to be a Color.Default selection?
Do you have any idea what the "default" row background settings are? It sure seems to be a little more complex than a setting. My reasoning, the control is going to change the background color when the row is activated. Even if it is set to "Default", it is going to be some color other than what I made up for that particular row.
I know the control is saving the "orginal" appearance, somewhere, because when you leave the row it sets it back to the pre-"active" state.
What am I missing????
If you are creating the grid at run-time, then the articles link here does not apply.The default ActiveRowAppearance gets applied by a preset which is loaded by the grid designer. If the grid is never on the form at design-time, then there is no designer and therefore no preset. So the appearance must be coming from somewhere else in your case. The question is.. where is it comeing from.
Are you loading a preset at run-time?
Are you loading a layout?
Are you loading an application style?
I was not entirely acurate in my description. I do have the grid on the form at design time. I'm just not appling any formating to it in the designer. I'm expliciately laying it out in the code. (Don't worry, I don't do this often this is a special case.)
No I'm not loading a preset at run-time, but there is one applied. No I'm not using application styling.
I guess my question is how to set set the ActiveRowAppearance to "Default" in code. Assuming that "Default" means "do nothing to the row" at all. So far it does not appear that it works that way to me. It appears to me, that the active row appearance gets applied to the row. It appears that I can override the appearance via the BeforeRowActivate event handler, but I can only deal with the Row Appearance and not the individual cells?
Thanks for taking the time to help me with this. I hope that I'm not being to obtuse...
Hi Dan,
danhsoho said:I was not entirely acurate in my description. I do have the grid on the form at design time. I'm just not appling any formating to it in the designer. I'm expliciately laying it out in the code. (Don't worry, I don't do this often this is a special case.)
If you placed the grid on the form at design-time, then it probably loaded the default Preset, which would have loaded an ActiveRowAppearance. So if that's where the ActiveRowAppearance is coming from, then following the steps in the KB article should work.
danhsoho said:No I'm not loading a preset at run-time, but there is one applied. No I'm not using application styling.
I don't understand what this means. How is there one applied if you are not applying it at run-time? If it's the one that got applied at design-time, then once again, the KB article should resolve the issue.
danhsoho said: I guess my question is how to set set the ActiveRowAppearance to "Default" in code. Assuming that "Default" means "do nothing to the row" at all. So far it does not appear that it works that way to me. It appears to me, that the active row appearance gets applied to the row. It appears that I can override the appearance via the BeforeRowActivate event handler, but I can only deal with the Row Appearance and not the individual cells?
Resetting the ActiveRowAppearance will restore it to the original state which will do nothing to the row.
I think you might be under a basic misapprehension here about how appearances work. The ActiveRowAppearance property is never really set on the row. And it doesn't get un-set on the row when it is no longer active. The way the grid works is that each cell determines how to paint itself at the time of painting. So the cell's UIElements ask the grid what they should look like and then the cell paints using the colors provided by the grid. When the cell is active, the grid will give the cell the colors of an active cell (or row). When it's not active, it gives it the normal colors.So there's no color property on the row itself that gets set or cleared in order for the active row appearance to work.
Ok let me see what happens. Thanks for being so patient with me.
Ok well I did as suggested. I have reset the following:
grid.override.ActiveRowAppearancegrid.override.SelectedRowAppearancegrid.DisplayLayout.band(0).override.ActiveRowAppearancegrid.DisplayLayout.band(0).override.SelectedRowAppearance
(I checked all of the other "appearance" settings at both levels and they are all reset as well.)
Now when the grid loads the active row DOES NOT change the formating of the first row. However, as soon as I click on a row the dreaded blue backgroundcolor and white foreground color is back on all of the cells.
Putting the following code in the BEFOREROWACTIVATE event and I can keep the overall background of the row correct. But it does not help me with the cell in the row that I have colored based upon data.
grid.DisplayLayout.Bands(0).Override.ActiveRowAppearance.BackColor = e.Row.Appearance.BackColorgrid.DisplayLayout.Bands(0).Override.ActiveRowAppearance.ForeColor = Color.Black
Since there are not active Cells on the row, i didn't figure ActiveRowCellAppeance would help?OR -- Should I not be getting the blue line when I select a row?
Okay, Active and Selected are two different things. There's actually no way to turn off the selected colors. But you can turn off selection of rows. So if selection is the problem, now, then what you should do is set SelectTypeRow to None. You might also want to check out the CellClickAction property and set it so that clicking on a row does not select the row.