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
2060
Alternating column colours
posted

Hi, 

Is there a way to make it look like the column's background alternate between two colours using the AppStylelist?

Thank,

Nathan

  • 37774
    Verified Answer
    posted

    No, this is only supported in rows.  You would have to code this yourself, the best place likely being in the InitializeLayout event of the grid, i.e.:

     private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
    {
        for (int i = 0; i < e.Layout.Bands[0].Columns.Count; i++)
        {
            if (i % 2 == 0)
                e.Layout.Bands[0].Columns[i].CellAppearance.BackColor = Color.Green;
            else
                e.Layout.Bands[0].Columns[i].CellAppearance.BackColor = Color.Blue;
        }
    }

    -Matt