Version

ListIndex Property (UltraGridRow)

Returns the index corresponding to this row from the IList that the control is bound to. Return value of -1 indicates that a row has been deleted or doesn't exist anymore.
Syntax
'Declaration
 
Public ReadOnly Property ListIndex As Integer
public int ListIndex {get;}
Example
Following code illustrates how ListObject and ListIndex properties off the UltraGridRow work. ListObject returns the underlying list object. For example, when bound to a DataSet, list objects would be DataRowView objects. ListObject and ListIndex provide a way to access underlying row objects in the bound data source.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

		' Use the same data source and data member to access the currency manager in the
		' button's click handler below.
		Me.ultraGrid1.SetDataBinding(Me.DataSet11, "Customers")

   End Sub

   Private Sub Button87_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button87.Click

       ' Get the currency manager.
       Dim cm As CurrencyManager = CType(Me.BindingContext(Me.DataSet11, "Customers"), CurrencyManager)

       Dim row As UltraGridRow = Me.UltraGrid1.Rows(0)

       Dim listObject1 As Object = row.ListObject
       Dim listObject2 As Object = cm.List(row.ListIndex)

       ' Write out the type names. If we are bound to a data set like in this case, these
       ' objects should be DataRowView objects.
       Debug.WriteLine("listObject1 type = " & listObject1.GetType().Name)
       Debug.WriteLine("listObject2 type = " & listObject2.GetType().Name)

       ' Following should write out true.
       Debug.WriteLine("Are listObject1 and listObject2 the same: " & (listObject1 Is listObject2))

   End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void Form1_Load(object sender, System.EventArgs e)
{

	// Use the same data source and data member to access the currency manager in the
	// button's click handler below.
	this.ultraGrid1.SetDataBinding( this.dataSet11, "Customers" );

}

private void button87_Click(object sender, System.EventArgs e)
{

	// Get the currency manager.
	CurrencyManager cm = (CurrencyManager)this.BindingContext[this.dataSet11, "Customers"]; 

	UltraGridRow row = this.ultraGrid1.Rows[0];

	object listObject1 = row.ListObject;
	object listObject2 = cm.List[ row.ListIndex ];

	// Write out the type names. If we are bound to a data set like in this case, these
	// objects should be DataRowView objects.
	Debug.WriteLine( "listObject1 type = " + listObject1.GetType( ).Name );
	Debug.WriteLine( "listObject2 type = " + listObject2.GetType( ).Name );

	// Following should write out true.
	Debug.WriteLine( "Are listObject1 and listObject2 the same: " + ( listObject1 == listObject2 ) );

}
Requirements

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

See Also