Hi, I have a user control and have a grid inside that. I am setting Grid's one of the columns header TextHAlign as Center.
I could find this settings in designer file
appearance56.TextHAlignAsString = "Center";ultraGridColumn3.Header.Appearance = appearance56;
If I run the App it doesn't center the header caption. I have figured out some wired and bizarre hacks to make it work.
After InitializeComponent() in constructor If I set the settings for this specific column or someother column, then magically all settings are applied and works fine.
ultrarid.DisplayLayout.Bands[0].Columns[1].CellAppearance.TextHAlignAsString = "Center";
Another hack is, if query that property in VS immediate window, it works.
Any help is appreciated.
Thanks,
Se
Hm, in that case, it's probably a problem with the form designer's handling of visual inheritance. The Form designer in DotNet doesn't handle collections very well when dealing with nested or inherited controls.
There's not much we can do about that, unfortunately. The best thing to do is to apply the settings you need in code, rather that through the designer. I recommend using the grid's InitializeLayout event to set up the properties of the bands and columns.
Mike Thanks for the reply. But I am not binding it on run time.
Hi Se,
It's hard to say without seeing a sample, but my guess is that this has nothing to do with the UserControl. Most likely, the DataSource you are attaching to the grid at run-time does not match the design-time data structure.
Here's a KB article that might help:
HOWTO:How can I define columns in the grid at Design-time and bind them at run-time so that some fields of the data are excluded from the grid?