I've searched everywhere but there doesn't seem to be any NotifyIcon for wpf, all the results i've found says "use the old windows.forms one instead" ![]()
Does this also mean that you can't use the WPF contextmenu for this notifyicon
You can of course not assign a WPF contextmenu to the old notifyicon's Contextmenu-property but is there any hacks that can move a wpf contmenu into position and put it on top so it looks and behaves just like an old contextmenu that is assigned to the notifyicon
I've also read that as soon as you add windows-forms references to your wpf-assembly the program will start running in software-mode. Is that true Because if it does there seems to be no way to get notifyicons for wpf-apps. I need hardware-rendering.
Why is there no notifyicon btw ![]()

WPF Contextmenu for notifyicon
Jouni79
Hi Chimmee,
I didn't run the code before giving you evnthough I typed in VSEditor.That is why there came
System.ComponentModel.IContainer cnt = new System.ComponentModel.Container();
Next one is interesting one.Seems a bug(not sure) if we display Popup over the TaskBar.Try the same opening code in the click event.You could focus to TextBox.
void click(){
.....
popup.Placement =
PlacementMode.Mouse;popup.IsOpen =
true;}
Warm welcome to any MS experts or any others to talk on this.
Regards,
Joy
Dlloyd
Hi
Try this code to give focus to textbox.
void
nfyico_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e){
if (e.Button == System.Windows.Forms.MouseButtons.Right){
popup.Placement =
PlacementMode.MousePoint;popup.IsOpen =
true; this.Activate();//Does the trick.}
}
Regards
Joy
Narayan Kulkarni
Thanks, PlacementMode.Mouse did the trick :)
What is this line good for btw It works just as good without it if you'r using the other constructor for the notifyicon.
System.ComponentModel.IContainer cnt = new System.ComponentModel.Container();
I have another question regarding contextmenus.
Why can a TextBox inside a MenuItem.Header not get focus Even if you set StaysOpenOnClick to true nothing happends with the textbox. Buttons, inkcanvases and all other controls works just like they usually do in a normal window but not the TextBox

dakota367
The WB
Hi
Could you try as follows It uses the Popup than ContextMenu.In Popup too you could add any control.
void
Btn_Click(object sender, RoutedEventArgs arg){System.ComponentModel.
IContainer cnt = new System.ComponentModel.Container();System.Windows.Forms.
NotifyIcon nfyico = new System.Windows.Forms.NotifyIcon(cnt);nfyico.Icon =
new System.Drawing.Icon(@"c:\display.ico");nfyico.MouseUp +=
new System.Windows.Forms.MouseEventHandler(nfyico_MouseUp);nfyico.Visible =
true;}
void nfyico_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e){ if (e.Button == System.Windows.Forms.MouseButtons.Right) {popup.Placement =
PlacementMode.Mouse;popup.IsOpen =
true;}
}
Regards,
Joy
Dennis Mulder - dennismulder.net
Thanks! Works perfect