Hi VS,
Thank you for your interest in Syncfusion Products.
We don’t have any specific property to enable/disable the copy
paste functionality. In order to achieve your requirement, you can have a Boolean
property and dynamically you can change the Boolean value and accordingly those
copy paste events can be fired. If your requirement is different from this
please provide us a screenshot or video file or simple sample. So, that it
would be easy for us to provide prompt solution.
Please let us know if you have any other concerns.
Thanks & Regards,
AL.Solai.
Hi VS,
Thank you for your update.
If you want to disable the row being copied from grid, you can use ClipboardCanCopy event. Using this event, you can disable the Row to be copied by checking the selected range type is Rows. Please make use of below code and attached sample,
Code snippet:
//Trigering the ClipboardCanCopy event
this.gridControl1.ClipboardCanCopy += new GridCutPasteEventHandler(gridControl1_ClipboardCanCopy);
//To disable the Row to be copy
void gridControl1_ClipboardCanCopy(object sender, GridCutPasteEventArgs e)
{
//Checking whether selected range type is Row
if (e.RangeList.ActiveRange.RangeType == GridRangeInfoType.Rows)
{
//Disabling the Copy
e.Result = false;
e.Handled = true;
}
}
Note:
As above customization, you can use above code Cut and Paste events.
Please let me know if you have any concerns.
Regards,
Neelakandan
Hi VS,
Thank you for your update.
It seems that you have not uploaded any sample in your previous update. However we have analyzed your reported scenario. In our previous update, we have provided the solution to restrict the whole row to be copied. The CanCopy event properties will be same in all type of ranges copied. But the type of the selected range can be differentiated by using RangeType property of ActiveRange. Here we have provided the video and sample.
If you have selected Row Range, the RangeType will be Rows. As like Row range, If you have copied data with in cell then RangeType will be Empty. If I misunderstood your query, please provide us sample and screenshot. It would be more help for us to provide better solution as soon as possible.
Code Snippet:
//To disable the Row to be copied
void gridControl1_ClipboardCanCopy(object sender, GridCutPasteEventArgs e)
{
//Checking whether selected range type is Row
if (e.RangeList.ActiveRange.RangeType == GridRangeInfoType.Rows)
{
//Disabling the Copy
e.Result = false;
e.Handled = true;
}
//checking whether copied text is within Cell
else if (e.RangeList.ActiveRange.RangeType == GridRangeInfoType.Empty)
{
MessageBox.Show("It is not Row range...So can be copied");
}
}
Sample and Video:
http://www.syncfusion.com/downloads/support/directtrac/118421/Sample_And_Video233374311.zip
Please let me know if you have any concerns.
Regards,
Neelakandan
Hi VS,
Thank you for your update and cooperation.
The selection range type will always be RowType If ListBoxSelectionMode is used for highlighting the row selection. By default, the RangeList will be returned in the CanCopy event as RowType if ListBoxSelectionMode is enabled. So you can achieve your scenario by only using AllowSelection property. Using that property, you can select any cells, rows, columns. So that RangeList can be differentiated in CanCopy event using AllowSelection property. For more details about ListBoxSelectionMode and AllowSelection mode, please refer to the below UG links,
UG Link:
http://help.syncfusion.com/ug/windows%20forms/Documents/howtomakethegridbeha.htm
http://help.syncfusion.com/ug/windows%20forms/Documents/recordbasedselection.htm
http://help.syncfusion.com/ug/windows%20forms/Documents/selections.htm
Note:
Here we have provided the sample in which we have used only AllowSelection property to select the rows, column, cells. So we request you to use AllowSelection property instead of using ListBoxSelectionMode property to achieve your reported scenario.
Sample:
http://www.syncfusion.com/downloads/support/forum/118421/Modified_Sample-803349302.zip
Please let me know if you have any concerns.
Regards,
Neelakandan