Version

ActiveCellChanging Event

The ActiveCellChanging event is raised before the currently ActiveCell is changed.
Syntax
'Declaration
 
Public Event ActiveCellChanging As EventHandler(Of ActiveCellChangingEventArgs)
public event EventHandler<ActiveCellChangingEventArgs> ActiveCellChanging
Event Data

The event handler receives an argument of type ActiveCellChangingEventArgs containing data related to this event. The following ActiveCellChangingEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from Infragistics.CancellableEventArgs) 
NewActiveCell Gets the Cell that is about to become the ActiveCell.
PreviousActiveCell Gets the Cell that was previously Active.
Remarks
This event is Cancellable.
Example
This sample demonstrates how to handle the ActiveCellChanging event which is fired the moment right before a cell becomes active.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Private Sub MyGrid_ActiveCellChanging(ByVal sender As System.Object, ByVal e As ActiveCellChangingEventArgs)

   ' Cancel the event if the user tries to active a cell in the ProductID column
   If e.NewActiveCell.Column.Key.Equals("ProductID") Then
      'Cancel the event
      e.Cancel = True
      Return
   End If
End Sub
private void MyGrid_ActiveCellChanging(object sender, ActiveCellChangingEventArgs e)
{
   // Cancel the event if the user tries to active a cell in the ProductID column
   if (e.NewActiveCell.Column.Key.Equals("ProductID"))
   {
      // Cancel the event
      e.Cancel = true;
      return;
   }
}
<ig:XamGrid KeyboardNavigation="CurrentLayout" 
           
x:Name="myGrid" 
           
AutoGenerateColumns="False"   
           
ActiveCellChanging="MyGrid_ActiveCellChanging" 
           
Grid.Row="0">
    … 
</ig:XamGrid>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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