DataGrid.CurrentCellChanged Ereignis
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Tritt ein, wenn die CurrentCell-Eigenschaft geändert wurde.
public:
event EventHandler ^ CurrentCellChanged;
public event EventHandler CurrentCellChanged;
member this.CurrentCellChanged : EventHandler
Public Custom Event CurrentCellChanged As EventHandler
Ereignistyp
Beispiele
Im folgenden Codebeispiel wird die Verwendung dieses Members veranschaulicht.
// Create an instance of the 'CurrentCellChanged' EventHandler.
private:
void CallCurrentCellChanged()
{
myDataGrid->CurrentCellChanged += gcnew EventHandler( this, &MyDataGrid::Grid_CurCellChange );
}
// Raise the event when focus on DataGrid cell changes.
void Grid_CurCellChange( Object^ /*sender*/, EventArgs^ /*e*/ )
{
// String variable used to show message.
String^ myString = "CurrentCellChanged event raised, cell focus is at ";
// Get the co-ordinates of the focussed cell.
String^ myPoint = String::Concat( myDataGrid->CurrentCell.ColumnNumber, ", ", myDataGrid->CurrentCell.RowNumber );
// Create the alert message.
myString = String::Concat( myString, "(", myPoint, ")" );
// Show Co-ordinates when CurrentCellChanged event is raised.
MessageBox::Show( myString, "Current cell co-ordinates" );
}
// Create an instance of the 'CurrentCellChanged' EventHandler.
private void CallCurrentCellChanged()
{
myDataGrid.CurrentCellChanged += new EventHandler(Grid_CurCellChange);
}
// Raise the event when focus on DataGrid cell changes.
private void Grid_CurCellChange(object sender, EventArgs e)
{
// String variable used to show message.
string myString = "CurrentCellChanged event raised, cell focus is at ";
// Get the co-ordinates of the focussed cell.
string myPoint = myDataGrid.CurrentCell.ColumnNumber + "," +
myDataGrid.CurrentCell.RowNumber;
// Create the alert message.
myString = myString + "(" + myPoint + ")";
// Show Co-ordinates when CurrentCellChanged event is raised.
MessageBox.Show(myString, "Current cell co-ordinates");
}
' Create an instance of the 'CurrentCellChanged' EventHandler.
Private Sub CallCurrentCellChanged()
AddHandler myDataGrid.CurrentCellChanged, AddressOf Grid_CurCellChange
End Sub
' Raise the event when focus on DataGrid cell changes.
Private Sub Grid_CurCellChange(ByVal sender As Object, ByVal e As EventArgs)
' String variable used to show message.
Dim myString As String = "CurrentCellChanged event raised, cell focus is at "
' Get the co-ordinates of the focussed cell.
Dim myPoint As String = myDataGrid.CurrentCell.ColumnNumber + "," + myDataGrid.CurrentCell.RowNumber
' Create the alert message.
myString = myString + "(" + myPoint + ")"
' Show Co-ordinates when CurrentCellChanged event is raised.
MessageBox.Show(myString, "Current cell co-ordinates")
End Sub
Hinweise
Um die aktuelle Zelle zu bestimmen, verwenden Sie die CurrentCell -Eigenschaft.
Gilt für:
Zusammenarbeit auf GitHub
Die Quelle für diesen Inhalt finden Sie auf GitHub, wo Sie auch Issues und Pull Requests erstellen und überprüfen können. Weitere Informationen finden Sie in unserem Leitfaden für Mitwirkende.