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
close icon

How to copy complete DataGrid as image to clipboard


I have a Syncfusion GridDataControl in my window and a button to copy the contents of the table to clipboard. xaml is given below for reference.

<RowDefinition Height="30"/>
<RowDefinition Height="*"/>

<Button Content="Copy to Clipboard" Height="25" Width="150" Click="CopyDatagrid1" HorizontalAlignment="Right"/>

<syncfusion:LayoutControl SkinPickerVisibility="Collapsed" TraceVisibility="Hidden" 
  UserOptionsVisibility="Hidden" Grid.Row="1" VisualStyle="SyncfusionTheme">

<syncfusion:GridDataControl x:Name="dataGrid1" AllowResizeRows="False"
AutoPopulateColumns="False" AutoPopulateRelations="False" ShowAddNewRow="False" ItemsSource="{Binding DataGrid1Source}" 
VisualStyle="SyncfusionTheme" AllowEdit="False" AllowSort="False">
<syncfusion:GridDataVisibleColumn MappingName="Column1" HeaderText="Column1" AutoFit="True"/>
<syncfusion:GridDataVisibleColumn MappingName="Column2" HeaderText="Column2" AutoFit="True"/>
<syncfusion:GridDataVisibleColumn MappingName="Column3" HeaderText="Column3" AutoFit="True"/>
<syncfusion:GridDataVisibleColumn MappingName="Column4" HeaderText="Column4" AutoFit="True"/>

I wanted to check if there is an option to copy the entire contents of the table including headers, formatting etc to clipboard and then paste it to image format.
Basically this table which I'm trying to put should be copied as image when the button is pressed.

Kindly advice on how to achieve this.


1 Reply

FP Farjana Parveen Ayubb Syncfusion Team July 15, 2019 10:25 AM UTC

Hi Magesh, 
Thank you for using Syncfusion controls. 
We have analyzed your query, we don’t have a direct support for copy the GridDataControl as an image in clipboard. So we have prepared a workaround for achieve your requirement by convert and copy the visible part of the GridDataControl to an image using RenderTargetBitmap class.   
Please refer the following link for sample, 
Please contact us for further assistance. 
Farjana Parveen A 

Live Chat Icon For mobile
Up arrow icon