获取WPF ContextMenu以在Winforms NotifyIcon上显示 [英] Get WPF ContextMenu to show on Winforms NotifyIcon

查看:175
本文介绍了获取WPF ContextMenu以在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.

http://weblogs.asp.net /marianor/archive/2007/10/15/a-wpf-wrapper-around-windows-form-notifyicon.aspx

这篇关于获取WPF ContextMenu以在Winforms NotifyIcon上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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