I have a grid with 3 bands. The 2 sub-bands are card view and I need different color schemes to help differentiate them.
So, I am trying to assign different stylesets to each band.
Is this possible?
Thanks in advance!
Bob
Hi Bob,
There may be different UIRoles in AppStylist for card than for regular rows. But AppStylist has no notion of Bands and there is no way to target a particular band with an application style.
You would have to do this in your application code.
Thanks Mike!
I'll just build them in the appearences collection.
Hi,
This is exactly the sort of thing I was hoping to do, apply the stylng to each band. As we can't but I am using appstyling for the application, can I override in code the band colour through code?
I've tried UltraGridData.DisplayLayout.Bands(0).Header.Appearance.BackColor = System.Drawing.Color.Violet but it doesn't seem to have any effect, and the appstyling overwrites this. Is this because the ISL file uses an image for the grid header background?
What I'm trying to achieve is any child bands of expanded bands have a lighter colour than it's parent. We are currently using dark blue for the band headers, we want the child band to be a slightly lighter blue than it's parent and it's child to be lighter etc. etc. I'm don't want to loose the appstyling, because I don't want to have to keep changing code should we need to re-skin the app.
Any suggestions on how I can achieve this would be greatly appreciated.
Nathan
Hi Nathan,
It could be an image is overriding the BackColor. It could also be that the headers are using themes and the themed drawing is overriding the BackColor.
Actually, since I last posted here, I have learned that it actually is possible to style different parts of the grid with different styles. What you do is use the Appearance.StyleLibraryName or StyleResourceName properties. These properties allow the appearance of an object to pick up the appearance from a different Isl file or a resource within an Isl.
Hi Mike,
I'm still not having much joy.
The first thing the app does is load the style library:
Infragistics.Win.AppStyling.StyleManager.Load("Resources\AppStyle.isl")
This works fine and gives us our blue colouring.
I created a new resource in that library called BandLevel1, and made it look pink to prove that the colours will change.
In my InitializeLayout event I call a method that adds summaries, calculated columns, formatting of columns and summaries, and then finally set the band colours. As I want the parent band to remain as the style library I was only changing those that have a parent band. My code is as follows:
If band.ParentBand IsNot Nothing Then
band.Header.Appearance.StyleResourceName = "BandLevel1"
End If
Next
This didn't seem to do anything so I added the following just before I set the StyleResourceName
band.Header.Appearance.StyleLibraryName = "Resources\AppStyle.isl"
That didn't work so I put the full path to the ISL file and still no joy.
I then tried used an existing resource "Default_GridRow_HotTracked" which is a grey colour but still no luck.
I've tried setting all the bands, regardless of whether they had a parent, but still nothing. I also tried using band.Layout.Appearance instead but nothing. Finally a completely different ISL file but same results.
Any ideas what I'm doing wrong?
Many thanks,
Just as a test, try this:
//band.Header.Appearance.StyleResourceName = "BandLevel1"
band.Header.Appearance.BackColor = Color.Pink;
If that doesn't work, then my guess is that your column headers are using themes and the themed drawing if overriding anything you might be doing in AppStylist. This is why when you create a new StyleSet in AppStylist, it prompts you to turn off themes.
If this DOES work, then I am at a loss to explain it. Perhaps you can create a small sample project that demonstrates it not working and Submit an incident to Infragistics Developer Support so they can take a look and see what's wrong.
StyleLibraryName is not the name of the style library file. It's a separate optional param of the Load method. You can speficy any name you want, it is not related to the file name in any way.
I removed the initial reference to the style library, Infragistics.Win.AppStyling.StyleManager.Load("Resources\AppStyle.isl"), and tried the colour change as you suggested. It did change the colour. I then tried using the .StyleLibraryName = "Resources\AppStyle.isl" (using the full file path) with .StyleResourceName = "BandLevel1" and it took no notice of it.
Themes are switched off on the grid, but how do I tell if themes are switched off in the Style Library. We didn't create any new stylesets as we inherited what was there from creating the library from an existing infragistics template "Template_Cherry".