Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1360
How to make cells look like headers
posted

Is there a way to make cells of a certain column look like the headers of a grid?

I have tried to clone the appearance, but that doesn't seem to do the trick...

 

 _grid.DisplayLayout.Bands[0].Columns["Test"].CellAppearance = (AppearanceBase)_grid.DisplayLayout.Override.HeaderAppearance.Clone();


Parents
  • 469350
    Verified Answer
    Offline posted

    If you examine the properties of the HeaderAppearance you are using here, you will probably see that none of them are actually set to anything - unless you set them. The Appearance properties don't contain the actual appearance of any given object. They exist so that you can override the default settings. At run-time, the grid resolves all of the appearances that affect an object, like it's HeaderAppearance, the HeaderAppearance on the Override, the Layout override, application styling, etc. 

    To get the actual properties of an object, you will need to resolve the appearance. The grid objects expose methods to allow you to resolve the appearances for most objects. In this case, you want the appearance of a header, so you need to find an individual header object and call it's ResolveAppearance method: 

    this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Header.ResolveAppearance(...)

    This will give you an AppearanceData object. From there you will need to create an Appearance and copy the property settings over (there's no wuick way to do it like Clone).

Reply Children