Hi
We have used AppStylist extensively on our winforms application. However one of the grids has two bands. As expected both bands use the style settings in the isl file, however this makes the UI difficult to 'read' especially when band(1) is expanded. To overcome this problem we would like to style band(1) differently by changing the color of some roles. Is this possible? If so what is best route to take?
Thanks
Hi,
It is not possible to do this using only AppStylist. AppStylist styles the whole application, and it doesn't have any way to know about items in a collection like Bands.
What you want to do can be done, but it requires you to make changes in the application.
What you can do is use the Appearance properties on the grid and point them to Resources in the isl file. For example, let's say you want all of the cells in Band 0 to be Yellow and all of the cells in Band 1 to be Green.
What you would do is open up AppStylist and add a couple of Resources. Let's call them "Yellow" and "Green". On the Yellow resource, you set a yellow BackColor, and likewise Green with green.
In your code, you apply the resource to the cells of each band like so:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; layout.Bands[0].Override.CellAppearance.StyleResourceName = "Yellow"; layout.Bands[1].Override.CellAppearance.StyleResourceName = "Green"; }
You would have to do something similar for the HeaderAppearance and any other Appearances you want to apply.
Of course, you really only have to do this on Band 1. You can just let Band 0 pick up the normal grid styling from the isl.
Hi Mike thanks for that - just the ticket!
This problem was solved using MIke's suggestion. Something worth mentioning; if I created a new Resource then it didn't display the chosen colour however if I edited an existing Resource then it did.