Hi
I understand that columns[0].cellAppearance.THAlign can be used to align text for that column. Do we have anything that 'll apply the same alignment to all the columns?
Something like Columns.CellAppearance.. instead of having to mention the column index
Thanks
Renu
Removing .Layout.Override resolved the issue. Why is the override not necessary?
In the InitializeLayout handler, I want set individual cell alignments as follows:
For colIx As Integer = 0 To e.Layout.Bands(0).Columns.Count - 1
With e.Layout.Bands(0).Columns(colIx)
.Format = modOrigFaceCorr.GridColFormatDict(colIx) ' ok
.Layout.Override.CellAppearance.TextHAlign = vbModule.GridColTextAlignDict(colIx) ' Sets for entire grid rather than column
End With
Next
The GridColTextAlignDict property provides dictionary access to the appropriate values. Stepping through the code shows that the values are correctly assigned but the grid picks up the last value for display on all cells.
Hi Renu,
Yes, you can set this at the Band level (for just one band) or the Layout level (for all bands).You do this by using the CellAppearance property on the Override object.There's an Override property on the Band and on the DisplayLayout.
You can even set it on all three levels if you want. The more specific setting always takes precedence over the more general one.
So you could set a single column to be Left-Aligned, the rest of the band to be right aligned, and all other bands to be center aligned.
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; UltraGridOverride ov = layout.Override; // All bands ov.CellAppearance.TextHAlign = HAlign.Center; // Just the root band band.Override.CellAppearance.TextHAlign = HAlign.Right; band.Columns[0].CellAppearance.TextHAlign = HAlign.Center; }
There's an Appearance on the cell, too, so you could even override this on each individual cell if you wanted to. :)