gpt4 book ai didi

c# - 插入符号停止 TextBox WPF 中的闪烁事件

转载 作者:行者123 更新时间:2023-11-30 16:57:33 25 4
gpt4 key购买 nike

我正在寻找当 TextBox 的插入符号停止闪烁时将触发的事件。假设我有:

<TextBox LostFocus="txtBox_LostFocus" />

为了触发事件 txtBox_LostFocus,另一个控件必须在该控件具有焦点的同时接收焦点。 如果我点击文本框 |开始闪烁。当我在文本框外单击时 |停止闪烁并且没有调用 LostFocus 事件,为什么? 只有在我单击另一个可聚焦控件时才会调用 LostFocus 事件。我怎么知道什么时候停止闪烁?

注意我称|游标也许它有一个不同的名字。

还有

当用户按下文本框上的 ENTER 以阻止插入符号闪烁时,我使用了 Keyboard.ClearFocus();。这也会引发 LostKeyboardFocus 事件!

最佳答案

我现在无法测试它,但可以查看 MSDNTextBox 类的可用事件有一个LostKeyboardFocus听起来可能就是您所追求的事件。

LostKeyboardFocus - Occurs when the keyboard is no longer focused on this element. (Inherited from UIElement.)

关于c# - 插入符号停止 TextBox WPF 中的闪烁事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26306374/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com