Caliburn Micro 'Enter' Key Event

前端 未结 2 2033
庸人自扰
庸人自扰 2020-12-24 08:37

I am attempting to bind an event with Caliburn Micro and I am having some issues getting the right messages to the method. I would like to add the ability to press the \'Ent

2条回答
  •  余生分开走
    2020-12-24 09:29

    If using keyeventargs as parameter type , and it gives u back null ,then look at this: You propably using System.Windows.Forms.KeyEventArgs and KeyEventArgs, as parameter type is refering to this, try with System.Windows.Input.KeyEventArgs (it works for me).

    public void ExecuteFilterView(System.Windows.Input.KeyEventArgs context)
    {
         if(context.Key==System.Windows.Input.Key.Return)
         {
             //action here
         }      
    }
    

提交回复
热议问题