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
245
Implementing a paste from a cell to a range
posted

I am capturing the key down event and checking for ctrl+v and handling custom behaviour

I need to be able to paste a cell to a range -- like copy one value and be able to paste it over a selected cell range. So if someone selected a cell with some value X, copied it and then selected a random range of cells and tried to paste , all the cells in the range would get it -- like EXCEL.

Has anyone done this before? Infragistics support -- is there a good way to do this?

 

Please advise.

Thanks,

  • 48586
    Verified Answer
    posted

    Hello Vivec,
    I have created a simple sample base on your requirements Please look at the attached sample and let me know if you have any further questions.

    WinGridCopyCells.zip
  • 469350
    Offline posted

    Hi,

    I haven't tried this, but it seems like it should be pretty straightforward. The hardest part will be deciding what to do when things go wrong. :)

    The basic approach I would take is to trap for CRTL+V, or better yet, use a Toolbar or a context menu with a shortcut for CTRL+V.

    Get the data from the clipboard and do all the usual checks to see if the clipboard contains a usable string.

    Once you have the string, you simply loop through the grid.Selected.Cells collection and set the value on each cell.

    You will, of course, have to decide what to do if this results in an error. For example, suppose one of the selected cells is a numeric type, or suppose one is read-only.