24
votes

When I click a cell in a WPF datagrid, the whole row is selected, and when I press Ctrl + C to copy the content, the whole row i copied...

How do I select and copy the content of a single cell?

3

3 Answers

39
votes

Use SelectionUnit Property of Datagrid.

2
votes

WPF datagrid comes up with the 'SelectionUnit' property.
You can set the following values 'SingleCell/FullRow/CellorRowHeader'.
If you want to select multiple rows, use the 'SelectionMode' property and set the value to 'Extended.'

0
votes

This is an option in the WPF grid, you should have a property named SelectionMode (or something like that depending of the datagrid you're using) that define how cells are selected.