Hi, i have this prob,
i want change the appearance at alternated columns in an ultragrid.
1 prob, i need to understand if the column in visible or not
2 prob i need to understand the visible order in the ultragrid
there is a columns collector of visibles columns (in the visible order)?
i start with:
For Each colonna In UltraGrid1.DisplayLayout.Bands(0).Columns If Not colonna.Hidden Then If scurisci Then colonna.CellAppearance.BackColor = Color.FromArgb(80, 80, 80) colonna.CellAppearance.ForeColor = Color.FromArgb(255, 255, 255) Else colonna.CellAppearance.BackColor = Color.FromArgb(255, 255, 255) colonna.CellAppearance.ForeColor = Color.FromArgb(80, 80, 80) End If scurisci = Not scurisci End If Next
but where i have a different visible sort not work, well i can retrive the visible order but i try to find the best solution.
tks
Hello,
You can get the first visible column using the UltraGridBand.GetFirstVisibleCol(), and then each subsequent column using the UltraGridColumn.GetRelatedVisibleColumn() method. I was able to achieve a similar effect using the following code:
Private Sub UltraGrid1_InitializeLayout(sender As Object, e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Dim layout = e.Layout Dim band = layout.Bands(0) Dim scrollRegion = layout.ColScrollRegions(0) Dim column = band.GetFirstVisibleCol(scrollRegion, True) Dim alternate As Boolean = False While column IsNot Nothing If alternate Then column.CellAppearance.BackColor = Color.Red End If column = column.GetRelatedVisibleColumn(Infragistics.Win.UltraWinGrid.VisibleRelation.[Next]) alternate = Not alternate End WhileEnd Sub
Please let me know if I can further assist you.
wow, its amazing your solution.
works very well tks a lot