获取WPF ContextMenu以在Winforms NotifyIcon上显示 [英] Get WPF ContextMenu to show on Winforms NotifyIcon
问题描述
我正在使用Winforms NotifyIcon
,因为没有WPF版本,我也在这里使用ContextMenu教程: http://www.wpftutorial.net/ContextMenu.html
I am using the Winforms NotifyIcon
as there is no WPF Version, I am also using the ContextMenu tutorial here: http://www.wpftutorial.net/ContextMenu.html
我将使用在此处的答案中找到的鼠标放置代码: http://social.msdn.microsoft.com/forums/en-US/wpf/thread/8cdd4ef1-d31e-42ef-a30e-7b482c0fa163/
And I will be using the mouse placement code found in the answer here: http://social.msdn.microsoft.com/forums/en-US/wpf/thread/8cdd4ef1-d31e-42ef-a30e-7b482c0fa163/
我的主要问题是,方法:
My main problem is, the method:
private void OpenContextMenu(FrameworkElement element)
{
if( element.ContextMenu != null )
{
element.ContextMenu.PlacementTarget = element;
element.ContextMenu.IsOpen = true;
}
}
如何使用?谁能告诉我我需要做些什么,才能让它显示在我的NotifyIcon中?
How is it used? Can anyone tell me what steps I will need to do just to get this to show up for my NotifyIcon
谢谢
推荐答案
我自己发现了这个,它确实很有效,而且很容易实现。
I found this one out myself, it does the job and very easy to implement.
这篇关于获取WPF ContextMenu以在Winforms NotifyIcon上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!