When I expand DisplayLayout in the properties window, then expand Appearance and change BackColor property, the change is not shown after I build? Are color schemes overriding my design time changes..? Or am I not changing the correct property??
Hi,
The Style Library will override the setting in your application by default.
You have two options.
1) You could change the ResolutionOrder in the style library. This would make you application settings take precedence over the style library. This is probably not what you want. It will let you change the BackColor on the grid, but it will also cause other appearances in your application to override the style library settings and it will probably look pretty ugly.
2) You could use a DrawFilter to override the backcolor on the UIElement in the grid that draws the background. If you are only concerned with a single grid and a single backcolor, then I'd recommend using the DrawFilter.
Of course, you could just change the grid's BackColor in the style library. This would affect all of the grids in you application. If you only want to affect one (or some) grids, then you could use multiple StyleSets in the style library to achieve this.
Yes I'm pretty sure I'm using a style library. Now I'm wondering how to override it. programmatically
I try accessing grid.DisplayLayout.Override but all i see are over 200 appearances...I have no idea what property to access.
The grid.DisplayLayout.Appearance affects the background area of the grid. That is, the empty area of the grid which is not covered by any rows, cells, scrollbars or any other objects.
The default color of the grid's background is the system Control color. So if your background color is white, then it sounds to me like something in you application is already changing this color and it may be overriding the property you are setting.
This could be something else in your code, such as explicitly setting the same appearance or loading a layout or a preset into the grid. Or it could be because you are loading a style library (isl) file into your application.
Thanks for the information, I probably do need to change something under the override property. The thing is, I want to change the background for the whole grid. So the grid is filling a whole space, and where there are no rows/cells is a blank white area...i want to change that color....I actually want the cells to be white.
One possible explanation is that you were expecting the cell backgrounds to change color by doing this, but that is not the way it works. If you want to change the background color for all cells, you can set the UltraGrid.DisplayLayout.Override.CellAppearance.BackColor.