Questions tagged «icommand»

5
WPF TextBox的命令,当我们按Enter键时将触发
将ButtonWPF应用程序中Command的绑定到VIEWMODEL类中的s非常容易。我想为达成类似的绑定TextBox。 我有一个TextBox,我需要将其绑定到Command当我Enter在TextBox聚焦时命中时触发的a 。目前,我正在为KeyUp事件使用以下处理程序,但它看起来很丑...而且无法将其放在VIEWMODEL班级中。 private void TextBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key == System.Windows.Input.Key.Enter) { // your event handler here e.Handled = true; MessageBox.Show("Enter Key is pressed!"); } } 有一个更好的方法吗?
76 c#  .net  wpf  icommand 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.