当ComboBox失去焦点时,是否有办法使WPF的ComboBox的弹出窗口保持扩展状态? [英] Is there a way to make WPF's ComboBox's popup to stay expanded when ComboBox loose focus?

查看:236
本文介绍了当ComboBox失去焦点时,是否有办法使WPF的ComboBox的弹出窗口保持扩展状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

对我来说,强制ComboBox在失去焦点时使其弹出框保持展开状态会很方便.有没有办法做到这一点.它并不需要成为ComboBox,而是SimpleComboBox,基于它们的任何UserControl以及从它们之中继承的任何CustomControl.

在此先感谢.

Dear all,

It would be convenient for me to force a ComboBox to keep its popup expanded when it looses focus. Is there a way to do this. It doesn''t heed to be ComboBox, but also SimpleComboBox, any UserControl based on any of them and any CustomControl which inherits from any of them.

Thanks in advance.

推荐答案

请参阅属性ComboBox.StaysOpenOnEdit.另外,您可以使用ComboBox.IsDropDownOpen属性(也是一个读写属性)来控制打开状态.

另外,您可以结合使用TextBoxListBox轻松模拟相似或更复杂的行为.有时ComboBox不够灵活.而且有些事件很难触发……无论如何,模拟ComboBox行为是一个流行的技巧,而不仅仅是在WPF中.

—SA
See the property ComboBox.StaysOpenOnEdit. Additionally, you can control the opened state by using ComboBox.IsDropDownOpen property, which is also a read-write property.

Alternatively, you can easily emulate similar or more complex behavior using the combination of TextBox and ListBox. Sometime ComboBox is not flexible enough; and some events are hard to trigger… Anyway, emulation of ComboBox behavior is a popular trick, not just in WPF.

—SA


这篇关于当ComboBox失去焦点时,是否有办法使WPF的ComboBox的弹出窗口保持扩展状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆