WPF可编辑组合框IsFocused问题
我正在通过修改 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用
IsKeyboardFocused
或IsKeyboardFocusWithin
相反You could try to use the
IsKeyboardFocused
orIsKeyboardFocusWithin
instead尝试使用位于ComboBox<内的TextBox控件的IsFocused或IsKeyboardFocused或IsKeyboardFocusWithin属性/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.