SL4 文本框上的 IsTabStop = False
我在文本框中将 IsTabStop 设置为 false,我知道这会使控件无法接收焦点,但根据 Silverlight Forums,它应该仍然能够接收鼠标事件。我在 tbxTotal_MouseLeftButtonUp 方法中连接了 MouseLeftButtonUp 事件和断点,并且在调试过程中永远不会命中它。 SL 论坛中的线程现在已经很旧了,所以也许这在某个更新中被更改了。我想要一个无法使用选项卡但仍可编辑的文本框。真的应该这么难吗?
I set IsTabStop to false on a text box and I know that this makes the control unable to receive focus, but according to the Silverlight Forums, it should still be able to receive mouse events. I have the MouseLeftButtonUp event wired and a breakpoint in my tbxTotal_MouseLeftButtonUp method, and it never gets hit during debugging. The thread in the SL Forums is pretty old now, so maybe this was changed in an update somewhere. I want a text box that can't be tabbed to, but is still editable. Should it really be this hard?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有意识到这一点,但情况似乎如此,此外,我似乎无法让 MouseLeftButtonUp 触发。 MouseLeftButtonDown 确实会触发,并且使用它您可以进行此黑客攻击。
然后在代码中你可以像这样处理事件。
将其包装在 CustomControl 中可能是值得的
I didn't realize this, but it seems to be the case, Additionally, I can't seem to get MouseLeftButtonUp to fire. MouseLeftButtonDown does fire though and using that you can do this hack.
Then in code you can handle the event like this.
It might be worth while to wrap it in a CustomControl
@seekerOfKnowledge:在
LostFocus
上禁用IsTabStop
是一个很好的方法,但是您的重新聚焦黑客是不必要的。第一次没有任何明显的效果,因为IsTabStop
的更改尚未生效。这种方法也可以与任何其他控制一起采用。@seekerOfKnowledge: Disabling
IsTabStop
on theLostFocus
is a good approach, but your re-focus hack is unnecessary. It fails to have any visible effect the first time around because the change ofIsTabStop
has not yet taken effect. This approach can be also be taken with any other control.