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
80
Weird TextHAlign cell property behavior?
posted

Hello.

I'm having problems with all the grids in my applicacion. I made a inherited grid from ultrawingrid, that I use in all my forms.

The problem is that suddenly, column alignment has gone mad. All columns appear left aligned even if I set the column CellAppearance.TextHAlign property to HAlign.Right.

I tried to change it right after binding the data by code with myGrid.DisplayLayout.Bands(0).Columns("MyCol").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right

This is in a sub called everytime I need to reload the grid.

The first time its called, nothing happens. All columns keep aligned to left, but second time it's called, ALL columns align to right, even though I only change one column's alignment.

Any clue? I'm going mad with this... as it happens at all the grids in my application and it didn't happen before. Is there any property I could have changed in my inherited grid that could do this mess? I checked the code of it and I'm not changing alignment anywhere on it.

Thanks in advance

 

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    My best guess is that something in your code is changing the TextHAlign at some other point. What I would do is put a button on the form that reads out this property setting, run the application, and then push the button to read out the value. Using a button ensures that you are reading the actual value of the property and that there are no issues of timing.

    Perhaps you are loading a layout or a preset into the grid that is setting this property?

    Another option is that you are setting the Appearance on the cell. The cell.Appearance will override the CellAppearance on the column.