Version

Selected Property (UltraGridCell)

Returns or sets a value that determines whether the cell is selected.
Syntax
'Declaration
 
Public Overrides Property Selected As Boolean
public override bool Selected {get; set;}
Remarks

Setting the Selected property of an object causes it to become selected. This property can also be used to determine whether the object has been selected.

Depending on the settings of the selection style property that applies to this object (SelectTypeCell) and maximum selection property (MaxSelectedCells) changing the value of the Selected property may affect the selection of other objects within the band or the control.

For example, if SelectTypeRow is set to 2 (SelectTypeSingle) so that only one row may be selected at a time, when you set the Selected property of an UltraGridRow object to True, the Selected properies of all other UltraGridRow objects will be set to False. As another example, if you have set the MaxSelectedRows property to 3, then attempt to set the Selected property to True for four rows, a run-time error will occur when you set the Selected property to True for the fourth row.

When an object is selected or deselected, the BeforeSelectChange event is generated.

Example
Following code shows how Selected property works. It toggles the selected state of the first cell in the first row. Continuously clicking on this button will select and unselect the cell.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button100_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button100.Click

      Dim cell As UltraGridCell = Me.UltraGrid1.Rows(0).Cells(0)

      ' Toggle the selected status of the row.
      cell.Selected = Not cell.Selected

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

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

	UltraGridCell cell = this.ultraGrid1.Rows[0].Cells[0];

	// Toggle the selected status of the row.
	cell.Selected = !cell.Selected;

}
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