简体   繁体   English

TextBox的GotFocus事件未触发

[英]GotFocus event of TextBox is not firing

I'm using Windows.UI.Xaml.Controls.TextBox developing Universal Windows App. 我正在使用Windows.UI.Xaml.Controls.TextBox开发通用Windows应用程序。 When text box is enabled GotFocus event normally fired. 启用文本框后,通常会触发GotFocus事件。 Otherwise when it is disabled I can't detect user interactions with it. 否则,当它被禁用时,我将无法检测到用户与其交互。 Somehow I need to know that user is trying to access the text box and notify him why he can't do so. 我需要以某种方式知道用户正在尝试访问文本框,并通知他为什么不能这样做。 Also I have tried to use Tapped event - no success. 我也尝试过使用点击事件-没有成功。

A disabled textbox won't fire the GotFocus event (or any other events, from what I can see). 禁用的文本框不会触发GotFocus事件(或其他事件,据我所知)。

Consider setting the IsReadOnly property to true instead of disabling the whole element. 考虑将IsReadOnly属性设置为true,而不是禁用整个元素。 Then events will still be able to fire. 然后事件仍然可以触发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM