Infragistics(R) NetAdvantage(R) Windows Forms
ListObject Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridRow Class : ListObject Property

Returns the object corresponding to this row from the IList that the control is bound to. Returns Null if this is an UltraGridGroupByRow.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property ListObject As Object
C# 
public object ListObject {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.

Visual BasicCopy Code
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
C#Copy Code
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 ) );

}

See Also