You can use the UltraGridOverride.RowAppearance and UltraGridOverride.RowAlternateAppearance properties to provide different appearance settings for odd and even rows in the grid. The IsAlternate property indicates which appearance the row will use. (Note that if no alternate appearance is specified, all rows will use the standard appearance and there will be no visible difference between alternate and non-alternate rows.)
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics Private Sub Button110_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button110.Click ' Setup the appearance for alternate rows. This will make for easy identification ' of alterante rows. Me.UltraGrid1.DisplayLayout.Override.RowAlternateAppearance.BackColor = Color.LightYellow ' Get the active row. Dim activeRow As UltraGridRow = Me.UltraGrid1.ActiveRow ' Write out whether the active row is alteranate row or not. Debug.WriteLine("ActiveRow.IsAlternate = " & activeRow.IsAlternate) ' Odd indexed rows are alternate rows. Write out whether the row's index is odd or even. If 0 = activeRow.Index Mod 2 Then Debug.WriteLine("ActiveRow's Index of " & activeRow.Index & " is even.") Else Debug.WriteLine("ActiveRow's Index of " & activeRow.Index & " is odd") End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button110_Click(object sender, System.EventArgs e) { // Setup the appearance for alternate rows. This will make for easy identification // of alterante rows. this.ultraGrid1.DisplayLayout.Override.RowAlternateAppearance.BackColor = Color.LightYellow; // Get the active row. UltraGridRow activeRow = this.ultraGrid1.ActiveRow; // Write out whether the active row is alteranate row or not. Debug.WriteLine( "ActiveRow.IsAlternate = " + activeRow.IsAlternate ); // Odd indexed rows are alternate rows. Write out whether the row's index is odd or even. if ( 0 == activeRow.Index % 2 ) Debug.WriteLine( "ActiveRow's Index of " + activeRow.Index + " is even." ); else Debug.WriteLine( "ActiveRow's Index of " + activeRow.Index + " is odd" ); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2