WPF:在ComboBoxItem的MouseOver上弹出PopUp [英] WPF: PopUp on MouseOver of a ComboBoxItem
问题描述
有没有人知道如何在ComboBoxItem的MouseOver上显示PopUp的示例? TIA
Does anyone know of an example of how to display a PopUp on MouseOver of a ComboBoxItem? TIA
编辑:我知道如何创建,样式和定位PopUp,但不知道如何显示它!我可能会退休。
I know how to create, style and position the PopUp but not how to display it! I may be retired.
推荐答案
在我们开始之前,您可以使用工具提示吗?
Before we start, could you just use a tooltip?
否则,设置ComboBoxItem的控件telmplate,将你的弹出窗口放在你想要的位置,但将Isopen属性设置为false。
otherwise, style the ComboBoxItem's control telmplate, include your popup in the style positioned where you want but set the Isopen property to false.
鼠标悬停,将弹出式窗口的IsOpen属性设置为true。
Use a trigger on mouse over to set your popup's IsOpen property to true.
这里是使用触发器OnMouseOver
here is an example of using a trigger OnMouseOver
的示例,在你的风格像这样: -
you will end up with a trigger in your style like this :-
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="thePopupsName"
Property="IsOpen"
Value="True" />
</Trigger>
</Style.Triggers>
当mouseOver发生时,弹出窗口会弹出,当弹出的弹出窗口将返回其默认值。
when the mouseOver occurs the popup will popup, when its gone the popup will return to its default value.
这篇关于WPF:在ComboBoxItem的MouseOver上弹出PopUp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!