0

I need to make an app that runs in the background in WPF and need it to have a Tray Icon... I tried many different things and also found another thread with the same question, but none of those answers work...I also tried using the TrayIcon class in System.Windows.Forms but even after referring it through COM it still shows the error

Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)

I also tried referencing the DLL file but when I do so all the WPF functions throw the error

{FunctionName e.g InitializeComponent} does not exist in the current context Any help is appreciated.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Garvit13
  • 5
  • 2
  • Rather mixing your WPF with Windows.Forms you can just get a WPF dedicated lib for Trayicons. I once used https://www.nuget.org/packages/Hardcodet.NotifyIcon.Wpf/ and it worked quiet good – Jodn Aug 16 '20 at 11:05
  • https://stackoverflow.com/q/1472633/366064 – Bizhan Aug 16 '20 at 11:13
  • I've used http://www.hardcodet.net/wpf-notifyicon in the past – Andy Aug 16 '20 at 11:13
  • @Jodn Thanks for the quick response but it throws an error that it can't find the .ico file. I tried complete path and the local path but still doesn't work...Everything else works... – Garvit13 Aug 16 '20 at 11:25
  • Edit - Thanks a lot to everyone, it now works after restarting VS... – Garvit13 Aug 16 '20 at 11:38
  • @Garvit13 right, that's a common bug with VS2019 currently. independent from your problem – Jodn Aug 16 '20 at 14:05

0 Answers0