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
620
Change appearance alternated columns in ultragrid
posted

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(808080)
            colonna.CellAppearance.ForeColor = Color.FromArgb(255255255)
        Else
            colonna.CellAppearance.BackColor = Color.FromArgb(255255255)
            colonna.CellAppearance.ForeColor = Color.FromArgb(808080)
        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

Parents
  • 2575
    Verified Answer
    Offline posted

    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 While
    End Sub

    Please let me know if I can further assist you.

Reply Children
No Data