简体   繁体   English

C#:WPF鼠标悬停

[英]C# : WPF Mouse Over

I need to create a WPF application , which contains two windows.. the window1 contains a button. 我需要创建一个WPF应用程序,其中包含两个窗口。window1包含一个按钮。 i need to show the second window when the cursor is over the button in first window [ Like tooltip ] . 当光标位于第一个窗口中的按钮上方时,我需要显示第二个窗口[如工具提示]。 if the mouse leaves, the second window should close.. 如果鼠标离开,则第二个窗口应关闭。

I'm new to WPF. 我是WPF的新手。 can any one help me with a sample code 有人可以帮我提供示例代码吗

If it is possible to do without your second window something like this is usually done in a tooltip, which has exactly that behaviour. 如果可以在没有第二个窗口的情况下进行操作,则通常会在工具提示中执行类似的操作,而该提示确实具有该行为。 (eg http://www.c-sharpcorner.com/UploadFile/mahesh/FancyWPFTooltip07132008214937PM/FancyWPFTooltip.aspx ) (例如, http : //www.c-sharpcorner.com/UploadFile/mahesh/FancyWPFTooltip07132008214937PM/FancyWPFTooltip.aspx

Check out System.Windows.Controls.Primitives.Popup . 签出System.Windows.Controls.Primitives.Popup It is maybe what you are seeking. 也许这就是您要寻找的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM