失去焦点后 TextBox 文本光标仍然可见
我在网格上有一个文本框。我用一些文本填充此文本框,当失去焦点时(我在包含带有文本框的网格的组件外部单击),我仍然可见文本光标。它不闪烁但可见。 WPF 不应该处理这个问题吗?
在此状态下标记不会闪烁,仅显示一个 |。
我不知道如何解决这个问题,有什么建议吗?
I have a textbox on a Grid. I populate this textbox with some text and when losing focus (I click outside this component containing the Grid with the textbox), I still have the text cursor visible. Its not blinking but is visible. Isn't WPF supposed to take care of this?
The marker is not blinking in this state, its just showing a |.
I have no idea how to approach this, any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了后代的缘故,我想指出,这可以在网格的 xaml 中完成一次,而不是每次文本框的焦点更改时完成。
For posterity sake I wanted to point out that this can be done once in the xaml for the Grid instead of every time focus changes for the TextBox.
通过将其添加到文本框的焦点事件来解决。
FocusManager.SetIsFocusScope(this, true);
Solved with adding this to the focus event for the textbox.
FocusManager.SetIsFocusScope(this, true);
“由于显示插入符号,但不闪烁,那么我猜测您的控件具有逻辑焦点,但没有键盘焦点。”
我相信这篇文章文本框光标不闪烁
将解释您的答案。
"Since the caret is shown, but not blinking, then I am guessing your control has Logical Focus, but not Keyboard Focus."
I believe this post TextBox Cursor is NOT blinking
will explain your answer.