Is there a way to turn off the alternating row colors? I can't seem to find where in our code this setting is initially set. But i want to be able to turn it on/off on demand from a form.
I tried following the samples here:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/HTML/Infragistics2.Win.UltraWinGrid.v11.1~Infragistics.Win.UltraWinGrid.UltraGridOverride~RowAlternateAppearance.html
And also went through hours of trial and error from solutions in this forum. It just won't turn off. Even if i set the back colors to White, the even rows will be a slightly darker white.
grid.Grid.DisplayLayout.Override.RowAppearance.BackColor = Color.White; grid.Grid.DisplayLayout.Override.RowAppearance.BackColor2 = Color.White; grid.Grid.DisplayLayout.Override.RowAlternateAppearance.BackColor = Color.White; grid.Grid.DisplayLayout.Override.RowAlternateAppearance.BackColor2 = Color.White;
Any ideas?
Caesar said:I could also turn off UseAppStyling for a specific control on the form right?
Yes, the UseAppStyling property on the grid can be turned off. But this will turn off all application styling for that control.
I could also turn off UseAppStyling for a specific control on the form right? I think that would be the best approach and least invasive to the current code base.
Hi,
There is another option. You could use StyleSets.
So the basic idea is that your Application Style Library's default StyleSet defines only the basics that are going to be the same for all grids.
Then you add a new StyleSet and set it to BasedOn the default. The new StyleSet can also contain optional grid styling, like the RowAlternateAppearance.
In your application(s), the grids will not have the RowAlternateAppearance unless you set the StyleSetName on the control to the derived StyleSet.
Thanks Mike. We are indeed using Application Styling. The problem is that we want all the grids to have a default look, but allow the user to also control the appearance of individual grids.
So i guess my only option it to not use Application Styling for the grids and instead do it manually through the code. Only then will i be able to control the appearance on demand.
The grid does not use any alternate row colors by default. So if you are seeing alternating row colors, something in your code must be turning this on and you will need to find that code and remove it.
There are only two ways this can happen.
The first way is using the RowAlternateAppearance property. So if you search your code for references to this property, you may be able to find where the colors are being applied.
But... it's possible that the property is being set without the word "RowAlternateAppearance" appearing anywhere in your code. This can happen if your code loads a layout or a preset into the grid. So you should also search your code for DisplayLayout.Load or PresetSerializer references.
The second possibility is that you are using Application Styling and the style library you are loading has alternate row colors applied. You can check for this by looking for a call to StyleManager.Load. If the colors are coming from AppStyling, then you will need to modify the style library in order to turn this off. It cannot be overridden by the code.