Answered by:
How to copy DataGridCell content to clipboard?

Question
-
If I set the DataGrid property IsReadOnly=False and when I make right click on the cell then I can copy the cell content to clipboard but then the user may allso change the content of the cell. I need to know how to select all cell content with mouse and copy it to clipboard while IsReadOnly set to True. I have tried Ctrl+C but then it copys the entire row to clipboard. I only need the cell content...Wednesday, February 16, 2011 9:20 AM
Answers
-
Hello GaiusBaltar,
I suggest you make a custom ContextMenu, with Copy/Paste menu items and programmatically copy your cell info into clipboard.
Cornel Croitoriu - Senior Software Developer - www.Biz-Forward.com | www.Croitoriu.NET- Marked as answer by Yves.Z Monday, February 28, 2011 3:42 AM
Thursday, February 17, 2011 1:53 PM -
Hi GaiusBalter,
You can change the selection unit of the datagrid as
DataGrid.SelectionUnit = DataGridSelectionUnit.Cell;
in order to select only cell to copy.
Also, this thread might help regarding the DataGrid copy issues.
http://social.msdn.microsoft.com/Forums/en/wpf/thread/87ac0303-28b1-41b6-b483-031d5e6278f9
Regards,
Binaya
- Proposed as answer by BinayaRaj Shrestha Tuesday, February 22, 2011 10:13 AM
- Marked as answer by Yves.Z Monday, February 28, 2011 3:42 AM
Tuesday, February 22, 2011 10:12 AM
All replies
-
Hello GaiusBaltar,
I suggest you make a custom ContextMenu, with Copy/Paste menu items and programmatically copy your cell info into clipboard.
Cornel Croitoriu - Senior Software Developer - www.Biz-Forward.com | www.Croitoriu.NET- Marked as answer by Yves.Z Monday, February 28, 2011 3:42 AM
Thursday, February 17, 2011 1:53 PM -
Hi GaiusBalter,
You can change the selection unit of the datagrid as
DataGrid.SelectionUnit = DataGridSelectionUnit.Cell;
in order to select only cell to copy.
Also, this thread might help regarding the DataGrid copy issues.
http://social.msdn.microsoft.com/Forums/en/wpf/thread/87ac0303-28b1-41b6-b483-031d5e6278f9
Regards,
Binaya
- Proposed as answer by BinayaRaj Shrestha Tuesday, February 22, 2011 10:13 AM
- Marked as answer by Yves.Z Monday, February 28, 2011 3:42 AM
Tuesday, February 22, 2011 10:12 AM -
We are marking this issue as "Answered". If you have any new findings or concerns, please feel free to unmark the issue.
Best regards
Yves Zhang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Monday, February 28, 2011 3:42 AM