失去焦点后 TextBox 文本光标仍然可见

发布于 2025-01-03 09:32:47 字数 152 浏览 5 评论 0原文

我在网格上有一个文本框。我用一些文本填充此文本框,当失去焦点时(我在包含带有文本框的网格的组件外部单击),我仍然可见文本光标。它不闪烁但可见。 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

爺獨霸怡葒院 2025-01-10 09:32:47

为了后代的缘故,我想指出,这可以在网格的 xaml 中完成一次,而不是每次文本框的焦点更改时完成。

<Grid FocusManager.IsFocusScope="True">
    <TextBox />
</Grid>

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.

<Grid FocusManager.IsFocusScope="True">
    <TextBox />
</Grid>
━╋う一瞬間旳綻放 2025-01-10 09:32:47

通过将其添加到文本框的焦点事件来解决。

FocusManager.SetIsFocusScope(this, true);

Solved with adding this to the focus event for the textbox.

FocusManager.SetIsFocusScope(this, true);

清音悠歌 2025-01-10 09:32:47

“由于显示插入符号,但不闪烁,那么我猜测您的控件具有逻辑焦点,但没有键盘焦点。”

我相信这篇文章文本框光标不闪烁
将解释您的答案。

"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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文