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
80
How to subscribe to "Cut (Ctrl+X)" on XamGrid
posted

Is there a way to subscribe to the Cut event on a XamGrid. I have tried hooking to: 

In XAML:

ClipboardCopying="OnClipboardCopying"

In .cs:

private void OnClipboardCopying(object sender, ClipboardCopyingEventArgs e)

{
// Get selected cells
List<CellBase> selectedCells = new List<CellBase>(e.SelectedItems);

// Clear the style of the previously selected cells
if (_previouslySelectedCells != null && _previouslySelectedCells.Count > 0)
{
SetCellStyle(_previouslySelectedCells, null);
}

// Check if the selected region of cells is valid for pasting
bool IsValidSelectedRec = e.ValidateSelectedRectangle();

if (IsValidSelectedRec)
{
// Color in blue the valid cell selection
System.Windows.Style CellStyleResource = this.Resources["CutRowStyle"] as System.Windows.Style;
this.SetCellStyle(selectedCells, CellStyleResource);
}
else
{

// Cancel the copying event if the selected region of cells is not rectangular 
e.Cancel = true;
}


_previouslySelectedCells = selectedCells;
}

but the OnClipboardCopying function is just being called on a Copy and not a Cut operation. Is there any other way to get around it?

Thanks!

Parents
  • 95
    posted

    Hello Erika B

    Thank you for contact Infragistics support.

    Regarding your inquiry, the XamGrid only support copy and paste for clipboard operation.

    Please check our online help page below.

    Copy-Paste support:

    http://ko.infragistics.com/help/wpf/xamgrid-copy-paste-support

    Let me know if you have any further question.

    Best Regards.

    Hyung 

    Infragistics Developer Support

Reply Children