【问题标题】:Can I bind a ReactiveCommand to MouseDown event on Textbox?我可以将 ReactiveCommand 绑定到 Textbox 上的 MouseDown 事件吗?
【发布时间】:2012-10-25 16:48:04
【问题描述】:

我正在尝试获取 WPF ReactiveUI 框架的新视图 ctor 绑定,以绑定正在处理按钮单击的 ReactiveCommand,以连接到 TextBox MouseDown/click 事件。以下不起作用。

public partial class KeypadNumberView 
    : IKeypadNumberView
    , IViewFor<IOnScreenKeyboard>
{
    public KeypadNumberView()
    {
        ViewModel = new KeyboardViewModel();

        InitializeComponent();

        this.Bind(ViewModel, x => x.EnteredText);
        this.BindCommand(ViewModel, vm => vm.Delete, v => v.EnteredText, "MouseDown" ); // doesn't work
        this.BindCommand(ViewModel, vm => vm.Delete); // <== works

【问题讨论】:

  • 我是个傻瓜,或者我只是不懂 TextBox 和 MouseDown。通过在 TextBox 上设置 Focusable="False" 已解决此问题。

标签: wpf textbox reactiveui


【解决方案1】:

这似乎应该有效。你可以在http://github.com/reactiveui/reactiveui 提交错误吗?

【讨论】:

  • 全部修复,见上面的评论。谢谢!
猜你喜欢
  • 1970-01-01
  • 2014-06-17
  • 1970-01-01
  • 2016-07-10
  • 1970-01-01
  • 2010-09-05
  • 2011-01-01
  • 1970-01-01
相关资源
最近更新 更多