DataGrid::SelectedCellsChanged Event

.NET Framework (current version)
 

Occurs when the SelectedCells collection changes.

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

public:
event SelectedCellsChangedEventHandler^ SelectedCellsChanged {
	void add(SelectedCellsChangedEventHandler^ value);
	void remove(SelectedCellsChangedEventHandler^ value);
}

You can handle the SelectedCellsChanged event to be notified when the collection of selected cells is changed. If the selection includes full rows, the Selector::SelectionChanged event is also raised.

You can retrieve the AddedCells and RemovedCells from the SelectedCellsChangedEventArgs in the event handler.

The following example shows how to handle the SelectedCellsChanged event and clear the values in the newly selected cells.

<Grid>
    <DataGrid Name="DG1" ItemsSource="{Binding}" SelectionUnit="CellOrRowHeader" SelectionChanged="DG1_SelectionChanged" SelectedCellsChanged="DG1_SelectedCellsChanged" />
</Grid>
No code example is currently available or this language may not be supported.

.NET Framework
Available since 4.0
Return to top
Show: