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
250
IsAlternate not alternating
posted

I would like to have 2 different colors for the alternate row color in one grid (only 1 band).

For rows of type X I use the value assigned to :

this.ultraGrid1.DisplayLayout.Override.RowAlternateAppearance.BackColor

But for rows of type Y I am trying to override this using the initialize row event...I try to do this

// first test for type Y row...
if (row.IsAlternate)

 {  
      row.Appearance.BackColor = Color.Green; 
}

However, when I view the results, the type Y rows do not alternate, they clump up in 2, 3 or more green rows in sequence.  

Is there anything I am doing wrong here?

Parents
  • 469350
    Offline posted

    Hi,

    My guess is that a row may be changing to and from an alternate at various staging of your application. For example, if you filter or sort the rows the some rows will become alternates and some that were alternates will become non-alternates. It's this latter group that is the problem, since the code you posted here never resets the appearance on the non-alternate rows.

    You probably just need to add an else block and reset the row appearance for rows that are not alternates.

     

Reply Children