本文介绍了如何在WPF中获取剪贴板内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个应用程序,当用户在Datagrid中选择行并按Ctrl C时,它必须获取剪贴板内容.按Ctrl V时必须粘贴.
我将模式设置为
Hi,
I am writing an application in which when user select rows in Datagrid and press Ctrl C, it has to get the clip board content. When Ctrl V is pressed it has to paste.
I am setting mode as
myDataGrid.ClipBoardCopyMode = Windows.Controls.DataGridCopyMode.ExcludeHeader
之后,我要获取剪贴板内容,如我们使用的Windows窗体中的
myDataGridView.GetClipboardContent()方法获取内容.
WPF中是否有类似于Windows Form的GetClipboardContent()的方法.
感谢任何建议,
Vijay
after this I want to get the clipboard content as in the windows form where we use
myDataGridView.GetClipboardContent() method to get the content.
Is there any method in WPF similar to GetClipboardContent() of Windows Form.
Appreciate any suggestions,
Vijay
推荐答案
Me.myDataGrid.SelectAllCells()
Me.myDataGrid.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader
ApplicationCommands.Copy.Execute(Nothing, Me.myDataGrid)
Dim tempString as String = Clipboard.GetData(DataFormats.CommaSeperatedValue)
Me.myTextBox.text = tempString
这篇关于如何在WPF中获取剪贴板内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!