WPF:在ComboBoxItem的MouseOver上弹出PopUp

编程入门 行业动态 更新时间:2024-10-26 23:25:07
本文介绍了WPF:在ComboBoxItem的MouseOver上弹出PopUp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有人知道如何在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

本文发布于:2023-10-06 19:41:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1467629.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出   ComboBoxItem   WPF   PopUp   MouseOver

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!