Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
510
Programmatically copy selected cells to clipboard
posted

Hello,

Thanks for the new copy/paste in grid!

I would like to add a context menu to my grid with an option to copy selected cells to clipboard. How do I  programmatically copy the selected cells in Infragistics grid to the clipboard?

What method should I call?

Regards,

  • 8421
    Verified Answer
    posted

    Hello,

    Currently the easiest way to accomplish this is to create a class that inherits from the XamGrid. Then, create copy and paste methods which in turn call base.CopyToClipboard() and base.PasteFromClipboard(). You would then use the custom grid in your project and call the new methods from the click event of the ContextMenuItem. I've attached a small sample that demonstrates this approach though I use a button rather than a context menu to call the copy operation.

    The reason this is needed is that the methods are marked as protected rather than being marked as public. We'll be exposing these methods publicly in the future.

    XamGridCopyPaste.zip