Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
**[View document in Syncfusion Flutter Knowledge base](https://www.syncfusion.com/kb/12644/how-to-capture-the-clipboard-events-of-wpf-spreadsheet)**
# How to capture the clipboard events of WPF SpreadSheet?

This sample illustrates how to capture the clipboard events of **WPF Spreadsheet**.

You can apture the clipboard operations using the [PreviewKeyDown](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.control.previewkeydown?view=netframework-4.6) event in the [WPF Spreadsheet](https://www.syncfusion.com/spreadsheet-editor-sdk/wpf-spreadsheet-editor) (SfSpreadsheet) control, in which the copy/paste could be captured using the keyboard shortcuts.

``` csharp
protected override void OnAttached()
{
//Event Subscription
this.AssociatedObject.PreviewKeyDown += AssociatedObject_PreviewKeyDown;
}

//Event Customization
private void AssociatedObject_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
//To capture the clipboard(copy/paste) opeartions
if ((Keyboard.IsKeyDown(Key.LeftCtrl)) && e.Key == Key.C)
{
MessageBox.Show("Control+C Pressed");
}
else if ((Keyboard.IsKeyDown(Key.LeftCtrl)) && e.Key == Key.V)
{
MessageBox.Show("Control+V Pressed");
}
}
```