DataGrid.CurrentCellChanged Event

Occurs when a different cell becomes the current cell.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

public event EventHandler<EventArgs> CurrentCellChanged
<sdk:DataGrid CurrentCellChanged="eventhandler"/>

The DataGrid current cell indicator can move to different cells as a result of mouse or keyboard gestures, or because of a CurrentColumn property value change.

The following example shows how to retrieve the value of the current cell using the CurrentColumn, SelectedItem and CurrentCellChanged members.

Run this sample

public partial class MainPage : UserControl
    public MainPage()
        System.Collections.ObjectModel.ObservableCollection<Color> myColors =
            new System.Collections.ObjectModel.ObservableCollection<Color>(){Colors.Red, Colors.Blue, Colors.Green};
        dataGrid1.DataContext = myColors;

    private void dataGrid1_CurrentCellChanged(object sender, EventArgs e)
        if (dataGrid1.SelectedItem != null)
            textBox1.DataContext = dataGrid1.CurrentColumn.Header.ToString() + ": " + 


<Grid x:Name="LayoutRoot" Background="White">
    <sdk:DataGrid Name="dataGrid1" AutoGenerateColumns="True" 
        SelectionMode="Single" ItemsSource="{Binding}"
        Height="129" Width="225" Margin="28,34,0,0" 
        HorizontalAlignment="Left" VerticalAlignment="Top" />
    <TextBox Name="textBox1" Height="24" Width="84" IsReadOnly="True" 
        HorizontalAlignment="Left" VerticalAlignment="Top" 
        Margin="259,83,0,0" Text="{Binding}" />


Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions