manav inder
manav inder

Reputation: 3601

How to get all the Selected Cells in WPF datagrid

I've a WPF datagrid, I want to get all the selected cells in the grid, I could do it by looping through all the items, so is there any built in way to do so?

I set two properties in DataGrid:

SelectionMode="Extended"   // for multiple selection

SelectionUnit="Cell"    //row should not be selected but cell should be

Thanks.

Upvotes: 1

Views: 4292

Answers (2)

Mordin
Mordin

Reputation: 1

I know that Grid.selecteditem works for row select; I would think it should work on cells too.

Upvotes: 0

icebat
icebat

Reputation: 4774

DataGrid has SelectedCells property. Is it what you`re looking for?

Upvotes: 6

Related Questions