WPF可编辑组合框IsFocused问题

发布于 2024-08-14 09:04:09 字数 454 浏览 12 评论 0原文

我正在通过修改 ComboBox ControlTemplate 来开发带水印的 ComboBox。当 ComboBox 不处于可编辑模式时一切都很好,但是当我将编辑模式更改为 True 时,IsFocused 属性永远不会设置为 True。这是因为在编辑模式下,ComboBox 使用TextBox。这是此 StackOverflow 的精确副本问题:。该问题没有得到答复。

如果您知道如何解决此问题,请留言,或者请指出提供 Watermark ComboBox 实现的链接。 谢谢, 雷伊.

I am developing a Watermarked ComboBox by modifying the ComboBox ControlTemplate. Everything is fine when the ComboBox is not in an editable mode, but when I change the edit mode to True, the IsFocused property is never set to True. This is because in edit mode, the ComboBox is using a TextBox. This is an exact copy of this StackOverflow question: . There are no responses to that question.

Please drop a line if you know how to solve this, or please point me to links that provide a Watermark ComboBox implementation.
Thanks,
Rey.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

熊抱啵儿 2024-08-21 09:04:09

您可以尝试使用 IsKeyboardFocusedIsKeyboardFocusWithin 相反

You could try to use the IsKeyboardFocused or IsKeyboardFocusWithin instead

几味少女 2024-08-21 09:04:09

尝试使用位于ComboBox<内的TextBox控件的IsFocusedIsKeyboardFocusedIsKeyboardFocusWithin属性/em> 控制。可以在 e.OriginalSource(TextChangedEventArgs 属性)中找到文本框。

这对我有用。

Try using the IsFocused or IsKeyboardFocused or IsKeyboardFocusWithin properties of the TextBox control which is within the ComboBox control. The TextBox can be found at e.OriginalSource(TextChangedEventArgs property).

It worked for me.

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