如何覆盖 WPF 文本框上的复制命令?
我想重写 WPF 文本框的 RoutedUICommand“复制”行为。
是否可以不创建一个继承自 TextBox 的新 TextBoxExtended 类?
我已经达到了这一点,但现在我有点迷失了。
Private Sub tbSource_PreviewExecuted(ByVal sender As System.Object, ByVal e As System.Windows.Input.ExecutedRoutedEventArgs)
Dim commandName = DirectCast(e.Command, Input.RoutedUICommand).Text
If commandName = "Copy" Then
End If
End Sub
您知道如何继续吗?
I would like to override the behavior of RoutedUICommand "Copy" of a WPF TextBox.
Is it possible without creating a new TextBoxExtended class that inherits from TextBox?
I have reached that point, but now I am bit lost.
Private Sub tbSource_PreviewExecuted(ByVal sender As System.Object, ByVal e As System.Windows.Input.ExecutedRoutedEventArgs)
Dim commandName = DirectCast(e.Command, Input.RoutedUICommand).Text
If commandName = "Copy" Then
End If
End Sub
Do you have any idea how to continue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将命令绑定添加到文本框以处理“复制”命令。例如,像这样:
You can add a command binding to the text box to handle the "Copy" command. For example, like this: