优先考虑AccessKey的特定用户控件 [英] Prioritise AccessKey's of specific usercontrols
问题描述
我有一个带有usercontrol X的页面,其中包含带有AccessKey的控件。在某些时候,我想在页面上添加另一个usercontrol Y(显示为叠加层),我也想为其定义AccessKey。 AccessKey中存在重叠,因为
的控件数量。调用两个用户控件中使用的AccessKey将调用usercontrol X中的控件而不是Y.有没有办法禁用usercontrol X的AccessKey,甚至更好的方法是让usercontrol Y为AccessKey设置第一个首选项
?
I have a page with usercontrol X which contain controls with AccessKey's. At some point I want to add another usercontrol Y to the page (displayed like an overlay) for which I also want to define AccessKey's. There is an overlap in AccessKey's because of the number of controls. Invoking an AccessKey used in both usercontrols will invoke the control in usercontrol X and not of Y. Is there a way to disable the AccessKey's of the usercontrol X, or even better, to have usercontrol Y to have first preference for AccessKey's?
推荐答案
你好,
Hello,
欢迎
到开发通用Windows应用论坛 !请使用 标记 当
发布到此论坛时,谢谢!
来自
官方文件,我们知道
系统通过处理添加到可视树中的第一个元素的访问键来解析重复访问键,忽略所有其他元素。 通过使用唯一的访问键或作用域命令来避免冲突。
如果你想首先在usercontrol Y中触发AccessKey,你可以尝试添加用户控件Y早于XAML树中的usercontrol X或设置usercontrol X的
IsEn能够 属性 false。
If you do want to fire the AccessKey in usercontrol Y first, you can try to add the usercontrol Y earlier than usercontrol X in the XAML tree or set usercontrol X’s IsEnabled property false.
祝你好运,
Breeze
这篇关于优先考虑AccessKey的特定用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!