We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Unable to copy the data when GridCopyOption set as IncludeHeaders in SfDataGrid - From 179070

Thank you so much for your reply.  Yes, I can see that reducing the opacity shows the selected cells.  However, I do have to compromise on my desired cell background colours.

Also, and I'm afraid I couldn't get your sample to compile, but although a selection rectangle is now shown, Ctrl+C does not copy the selected cells to the clipboard.  I have:

                        GridCopyOption="IncludeHeaders"

                        SelectionMode="Extended"

                        SelectionUnit="Cell"

So I don't understand why the copy functionality is not working.  I have another sfDataGrid in the application with the same settings but no converter and Ctrl+C works as expected there.


3 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team November 29, 2022 05:24 PM UTC

Hi Peter,

Your requirement to copy the selected cells in SfDataGrid can be achieved by setting the CopyData option in GridCopyOption property. Refer to the below code snippet,

<Syncfusion:SfDataGrid

                        x:Name="tokenisedGrid"

                       AllowDraggingColumns="True"

                        AllowResizingColumns="True"

                        AllowTriStateSorting="True"

                        ColumnSizer="Auto"

                        Foreground="Black"

                        GridCopyOption="IncludeHeaders,CopyData"

                        SelectionMode="Extended"

                        SelectionUnit="Cell"

                        ShowBusyIndicator="True"

                        ItemsSource="{Binding Orders}"

                        ShowGroupDropArea="True"

                        ShowRowHeader="True"

                        ShowSortNumbers="True" />


Find the sample in the attachment.

UG Link: https://help.syncfusion.com/wpf/datagrid/clipboard-operations#copy-to-clipboard-in-datagrid

Regards,
Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_a03ea713.zip

Marked as answer

PE Peter replied to Vijayarasan Sivanandham November 29, 2022 05:57 PM UTC

Thank you!  My apologies... I clearly missed the "CopyData" option!  Many thanks for your help



VS Vijayarasan Sivanandham Syncfusion Team November 30, 2022 05:53 AM UTC

Peter,

We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you
😊.


Loader.
Up arrow icon