我该如何动态地更改将要粘贴到文本框中的内容。
以下是我的事件订阅方式:
DataObject.AddPastingHandler (uiTextBox, TextBoxPaste);
以下是我定义事件处理程序的方式:
private void TextBoxPaste (object sender, DataObjectPastingEventArgs args)
{
string clipboard = args.DataObject.GetData (typeof (string)) as string;
Regex nonNumeric = new System.Text.RegularExpressions.Regex (@"\D");
string result = nonNumeric.Replace (clipboard, String.Empty);
// I can't just do "args.DataObject.SetData (result)" here.
}