Hi,
I noticed when copying XamDataGrid contents to clipboard I can include the Headers via FieldLayoutSettings.CopyFieldLabelsToClipboard. When viewing in excel, the headers appear in bold format.
I would like to format contents of the grid based on bound properties - is this possible?
I have hooked into the Grid_Copying event and can check the copied DataItem from the eventArgs (e).
e.g.
var sourceRecord = e.GetSourceRecord.DataItem
//check 'ShouldBeStrikeThrough'
if(sourceRecord.ShouldBeStrikThrough)
//copy to clipboard with strike through format
I can do this by adding HTML to the clipboard and cancelling the event. This works well for excel but not a text viewer. How is the Header Bold format applied?
Hello,
Thank you for the provided information.
In order to investigate your scenario, could you please let me know what text viewer you are using?
Looking forward to your reply.
Any text viewer such as notepad/EditPlus etc.
I resolved the issue using the above mentioned link. I had to set the clipboard object with both plain text and html string - the receiving application Word
/Excel/Notepad etc then reads the correct data item when pasting. Works nice. Is this how Infragistics implements default copying behaviour when including headers?
I am glad you were able to achieve the functionality you are looking for.
If you need additional information on copying data to clipboard, I suggest taking a look at this Series of Topics:
http://www.infragistics.com/help/wpf/xamdatagrid-clipboard-operations
The closest to your scenario is Prevent the Addition of Specific Formats to the Clipboard.