在WPF组合框的DataTemplate中访问Grid的键盘事件 [英] Access keyboard event of Grid in DataTemplate of WPF Combobox

查看:68
本文介绍了在WPF组合框的DataTemplate中访问Grid的键盘事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了WPF组合框,该网格在组合框的ItemTemplate内的DataTemplate中放置了一个网格.
我正在尝试访问该特定网格的keyup事件.但这不会触发.

谢谢.

I have used a WPF Combobox having a Grid placed in DataTemplate inside ItemTemplate of the Combobox.
I am trying to access keyup event of that particular grid. But it does not fire.

Thank you.

推荐答案

这很简单.您需要像
这样使用EventSetter
This is pretty easy stuff. You need to use EventSetter like

<eventsetter event="KeyUp" handler="KeyUp_Handler" />



然后为KeyUp_Handler



then write the code for KeyUp_Handler


这篇关于在WPF组合框的DataTemplate中访问Grid的键盘事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆