WPF NotifyIcon

July 29th, 2019

Version 1.0.8 released April 2nd 2016.

This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF framework in order to display rich ToolTips, Popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.

image

Browse/fork/clone on GitHub (includes sample application)
Download library via NuGet

Features at a glance

  • Custom Popups (interactive controls) on mouse clicks.
  • Customized ToolTips (Vista and above) with fallback mechanism for xp/2003.
  • Rich event model including attached events to trigger animations in Popups, ToolTips, and balloon messages. I just love that.
  • Full support for standard Windows balloons, including custom icons.
  • Custom balloons that pop up in the tray area. Go wild with styles and animations 🙂
  • Support for WPF context menus.
  • You can define whether to show Popups on left-, right-, double-clicks etc. The same goes for context menus.
  • Simple data binding for Popups, ToolTips and custom balloons through attached properties and derived data context.
  • Command support for single / double clicks on the tray icon.

Tutorial and Support

      • A comprehensive tutorial that complements the attached sample application can be found on the Code Project:

http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx

Please post support questions to the CodeProject forum only. Thank you.

Screenshots

The screenshots below were taken from NetDrives and the sample application.

quickaccess

image

image

image

image

XAML Declaration Sample

The sample below shows some of the properties of the control. For a more comprehensive sample, have a look at the sample application that comes with the download.

<Window
  x:Class="Hardcodet.NetDrives.UI.SystemTray.Sample"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:tb="http://www.hardcodet.net/taskbar">

    <tb:TaskbarIcon x:Name="myNotifyIcon"
                    Visibility="Visible"
                    ToolTipText="Fallback ToolTip for Windows xp"
                    IconSource="/Images/TrayIcons/Logo.ico"
                    ContextMenu="{StaticResource TrayMenu}"
                    MenuActivation="LeftOrRightClick"
                    TrayPopup="{StaticResoure TrayStatusPopup}"
                    PopupActivation="DoubleClick"
                    TrayToolTip="{StaticResource TrayToolTip}"
      />

</Window>
  1. July 19th, 2015 at 11:04 | #1

    Some of the win8 users of my application are having troubles with the NotifyIcon since Thursday (maybe caused by a windows update?).
    Anyone else having similar problems?

    I don’t have win8, but from the Backtrace the users sent me it looks like a problem with the interop helper.

    Frameworkversion: v4.0.30319
    Beschreibung: Der Prozess wurde aufgrund eines Ausnahmefehlers beendet.
    Ausnahmeinformationen: System.ArgumentException
    bei System.Windows.Media.CompositionTarget.SetRootVisual(System.Windows.Media.Visual)

    bei System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object)
    bei Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.OnToolTipChange(Boolean)
    bei Hardcodet.Wpf.TaskbarNotification.Interop.WindowMessageSink.ProcessWindowMessage(UInt32, IntPtr, IntPtr)
    bei Hardcodet.Wpf.TaskbarNotification.Interop.WindowMessageSink.OnWindowMessageReceived(IntPtr, UInt32, IntPtr, IntPtr)

  2. July 29th, 2015 at 20:04 | #2

    Hello, I’m curious if you or perhaps anybody else here has seen the issue I’m seeing when trying to deploy. The application crashes on startup with the following debug information:

    ‘Set connectionId threw an exception.’ Line number ‘6’ and line position ‘9’.

    Could not load file or assembly ‘Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.

    at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
    at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
    at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
    at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
    at IronMan_UpdateService.MainWindow.InitializeComponent()
    at IronMan_UpdateService.MainWindow..ctor()

  3. esurface
    August 3rd, 2015 at 15:56 | #3

    @Rajeev
    Any update on this? I have the same issue.

  4. Antonio
    August 10th, 2015 at 16:08 | #4

    Hi Philipp,

    I’m a developer in China. I just want to say your library is great. At the same time, is it possible to ask your permission to use your Hardcodet WPF notifyicon on my software product (commercial)?

    Thanks!

    Antonio

  5. elbxs
    August 15th, 2015 at 01:03 | #6

    If you set the “visibility” property to false, the icon will flash briefly. Will there be a fix for this in a future patch, or is there a proper method of hiding the tray icon?

    (The reason I hide the icon, is that I have a “Tray Icon” option. If the user doesn’t want the icon, they can disable it.)

  6. Joe
    August 24th, 2015 at 23:30 | #7

    Apologies as I must be in error since I haven’t seen this come up; but I have not been able to set:
    – InitialShowDelay
    – ShowDuration
    – BetweenShowDelay

    via the tooltip service. I can set the vertical/horizontal offsets, so I’m not totally messed up. I’ve tried code and xaml. Has anyone had luck with these?

  7. Imtiaz
    September 1st, 2015 at 10:58 | #8

    Hi,
    I have been using your library for a while, and now we have localized our software.
    The balloon text is visible in all languages, but in Chinese/Korean etc it shows “?”
    Are you escaping non-ASCII characters?
    Thanks!

  8. Rony
    September 19th, 2015 at 15:00 | #9

    Hi,

    How can I force the popup to stay up even though it loses focus?

    Thanks!

  9. Brent Scriver
    October 23rd, 2015 at 00:01 | #10

    Hi, I have some deltas I would love to push back for supporting using the Guid for click once applications and to support the ContextMenuStrip for Forms (helps bridge the transition from Forms to WPF). I see there are a couple of forks on Github already.

  10. Joerg
    October 29th, 2015 at 06:42 | #11

    Hello Philipp,

    is this project still alive? I have been waiting for 1.1 for a very long time. Version 1.0.5 produces access violations when I try to show an OpenFileDialog in my App. So I’ve been stuck on 1.0.4, which has some other weird issues sometimes.
    I also could not find the original repository on GitHub. Any ieda?

  11. Nabil Droussi
    November 3rd, 2015 at 17:23 | #12

    Hello Philipp,

    First of all I would like to thank you for the great tool you created, it is really useful and we got the most of it in our project.

    I have a small request, can you please publish a strong name signed dll?

    Kind Regards,
    Nabil

  12. Manfred
    November 23rd, 2015 at 02:08 | #13

    @Joerg
    That’s a good question. Files are from 2013 😞

  13. November 24th, 2015 at 01:32 | #14

    @Philipp Sumi

    Great component – just wondering how you go on with adding a feature to remove the double click delay?

    Cheers

  14. KC
    December 1st, 2015 at 20:43 | #15

    Going off of the Windowless Sample project where the tray icon is declared in app.xaml.cs and double clicking on it opens the mainwindow.xaml, if there was a button on the window, how would the code in that button tell/access the taskbaricon to display a balloon?

  15. Abdul Manaf
    December 15th, 2015 at 14:06 | #16

    hi, am using hardcodet wpf taskbarnotification. its working fine . but some time it shows duplicate tray icons in the system tray. what is the reason. how to fix this problems. am very disappointed with this issue.

  16. Maulik
    January 9th, 2016 at 06:10 | #17

    Hi,
    Thanks for share such good library with us.
    I have been facing issue with tray tooltip. For some case(On window startup in window 8 and window 10) tool tip show on wrong postion. Can you please helo me to resolve this issue?

    Thanks

  17. Vasyl
    February 2nd, 2016 at 12:22 | #18

    Hi,

    My app occasionally throws (and crashes afterwards) the same exception @Dreamcooled had mentioned.
    But it has nothing to do with Win8, I run Win7.
    The exception appears randomly, most times the app works just fine.

    The quoted stack trace code below is exactly the same each time exception occurs:

    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.ArgumentException
    Stack:
    at System.Windows.Media.CompositionTarget.SetRootVisual(System.Windows.Media.Visual)
    at System.Windows.Media.CompositionTarget.set_RootVisual(System.Windows.Media.Visual)
    at System.Windows.Interop.HwndTarget.set_RootVisual(System.Windows.Media.Visual)
    at System.Windows.Interop.HwndSource.set_RootVisualInternal(System.Windows.Media.Visual)
    at System.Windows.Controls.Primitives.Popup.CreateWindow(Boolean)
    at System.Windows.Controls.Primitives.Popup.OnIsOpenChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
    at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
    at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
    at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
    at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
    at System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
    at System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object)
    at System.Windows.Data.BindingOperations.SetBinding(System.Windows.DependencyObject, System.Windows.DependencyProperty, System.Windows.Data.BindingBase)
    at System.Windows.Controls.Primitives.Popup.CreateRootPopup(System.Windows.Controls.Primitives.Popup, System.Windows.UIElement)
    at System.Windows.Controls.ToolTip.OnIsOpenChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
    at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
    at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
    at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
    at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
    at System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
    at System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object)
    at Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.OnToolTipChange(Boolean)
    at Hardcodet.Wpf.TaskbarNotification.Interop.WindowMessageSink.ProcessWindowMessage(UInt32, IntPtr, IntPtr)
    at Hardcodet.Wpf.TaskbarNotification.Interop.WindowMessageSink.OnWindowMessageReceived(IntPtr, UInt32, IntPtr, IntPtr)
    at MS.Win32.UnsafeNativeMethods.IntGetMessageW(System.Windows.Interop.MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32)
    at MS.Win32.UnsafeNativeMethods.IntGetMessageW(System.Windows.Interop.MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32)
    at System.Windows.Threading.Dispatcher.GetMessage(System.Windows.Interop.MSG ByRef, IntPtr, Int32, Int32)
    at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)

  18. Ryan
    February 4th, 2016 at 00:50 | #19

    Hi,

    Users are reporting that my icon is invisible in Windows 8 and 8.1.

    Do you know any fix for this? I’d appreciate it. Thanks.

  19. Jg
    March 8th, 2016 at 03:43 | #20

    Hey, not sure you have seen this but if not its a correct bug fix

    http://stackoverflow.com/questions/28238856/wpf-notifyicon-context-menu-not-centered-on-tray-icon-at-100-dpi

    In Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.ShowContextMenu()

    replace

    ContextMenu.HorizontalOffset = cursorPosition.X;
    ContextMenu.VerticalOffset = cursorPosition.Y;
    with

    var g = Graphics.FromHwnd(IntPtr.Zero);
    var scaleX = g.DpiX / 96.0;
    var scaleY = g.DpiY / 96.0;

    ContextMenu.HorizontalOffset = cursorPosition.X / scaleX;
    ContextMenu.VerticalOffset = cursorPosition.Y / scaleY;

    Explanation (thanks to codeproject user yachting):

    It’s needed because WinApi.GetPhysicalCursorPos return the mouse position in pixel, but WPF’s measurement unit is device independent pixel (by definition, it’s 1/96 inch) You need to adjust the return value of GetPhysicalCursorPos by DPI (dots per inch) setting, otherwise the position of the context menu will be incorrect if users set DPI other than the default 96.

  20. tomek lisiew
    March 11th, 2016 at 22:11 | #22

    Gr8 work mate, very friendly & useful!
    Got it working in seconds! Works like a charm!

    Had to build it manually though, Nuget fails to install, but that’s just a minor!

    Great day!

  21. Dean
    April 1st, 2016 at 16:35 | #23

    Just to thank you again for this great control and to ask for the email I can donate to via PayPal…

  22. Lasseo
    April 7th, 2016 at 17:42 | #25

    Works in standalone app, but when integrating it to existing app I end up in trouble. Any idea what is is conflict?

    Cheers,

    System.Windows.Markup.XamlParseException occurred
    _HResult=-2146233087
    _message=The type initializer for ‘Hardcodet.Wpf.TaskbarNotification.TaskbarIcon’ threw an exception.
    HResult=-2146233087
    IsTransient=false
    Message=The type initializer for ‘Hardcodet.Wpf.TaskbarNotification.TaskbarIcon’ threw an exception.
    Source=PresentationFramework
    LineNumber=0
    LinePosition=0
    StackTrace:
    at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
    InnerException: System.ArgumentException
    _HResult=-2147024809
    _message=Metadata override and base metadata must be of the same type or derived type.
    HResult=-2147024809
    IsTransient=false
    Message=Metadata override and base metadata must be of the same type or derived type.
    Source=WindowsBase
    StackTrace:
    at System.Windows.DependencyProperty.SetupOverrideMetadata(Type forType, PropertyMetadata typeMetadata, DependencyObjectType& dType, PropertyMetadata& baseMetadata)
    at System.Windows.DependencyProperty.OverrideMetadata(Type forType, PropertyMetadata typeMetadata)
    at Hardcodet.Wpf.TaskbarNotification.TaskbarIcon..cctor() in c:\git\OSS\notifyicon-wpf\Hardcodet.NotifyIcon.Wpf\Source\NotifyIconWpf\TaskbarIcon.Declarations.cs:line 1907
    InnerException:

  23. TonyE
    April 29th, 2016 at 12:30 | #26

    Occasionally this gives the error “Could not set OS Version”. We’re running Windows 7. Any thoughts on why this error is cropping up?

  24. TonyE
    April 29th, 2016 at 18:04 | #27

    Oops, the error reads “Could not set version”. Here’s the stack trace:

    —————————
    Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
    —————————
    Could not set version

    at Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.SetVersion()

    at Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.CreateTaskbarIcon()

    at Hardcodet.Wpf.TaskbarNotification.TaskbarIcon..ctor()

    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)

    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

    at System.Activator.CreateInstance(Type type, Boolean nonPublic)

    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)

    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder bi……

  25. Sebastian
    May 27th, 2016 at 17:52 | #28

    Hi Philipp,

    I am using your wpf Notify icon control.
    1) The Tooltip (basic) sometimes shows up on top right corner of the screen.
    2) Sometimes, the tray windows does not get closed
    3) Clicking again on the icon should close the opened window

    Any idea, how to achieve those above?

  26. andrew
    May 27th, 2016 at 18:09 | #29

    Very cool library that I just discovered. So lucky it was recently updated. Thanks for all your hard work on this!

  27. June 13th, 2016 at 19:27 | #30

    We are using this assembly in a 2015 WPF project .net 6.0 and everything has been working fine until we started to deploy using ClickOnce deployment. When we close the window we call the TaskbarIcon.ShowBalloonTip method to make the balloon appear and put an icon in the icon tray.

    However, when this is deployed with ClickOnce, everything still executes but the balloon does not popup. The app icon is still in the icon tray and behaves as expected.

    If I go to where the app is deployed and double click on the app’s exe everything will run as expected. If I make a shortcut to the app’s exe and use the shortcut to start the app – everything runs as expected. But when I click on the shortcut made by clickonce, the balloon fails to appear.

    Any advice on how to make this work in a ClickOnce installation?

    Thank you.

  28. June 14th, 2016 at 16:48 | #32

    @Philipp Sumi
    Hi Philip,

    Yes it could be related to that issue, but the link you provided listed a number of people with the same problem but offered no solution. Do you know of a fix or work around?

    Thank you.

  29. June 14th, 2016 at 16:52 | #33

    @George

    I’m afraid I don’t, sorry. If that part of the API is locked by Windows, there might not be a workaround. Can you revert to custom tooltips instead? They provide a richer user experience anyway…

  30. June 14th, 2016 at 17:04 | #34

    Thank you for the quick response Philipp.

    When we close the app’s window (wpf) a balloon pops up in the bottom right corner of the screen to notify the user that the app is still running in the background. are you saying it’s possible to make custom tooltips have the same behavior?

  31. June 14th, 2016 at 17:23 | #35

    Have a look at the sample app, which contains a sample with custom balloons. They allow you to display an arbitrary user control in the tray area.

  32. Siarhei Kuchuk
    June 16th, 2016 at 16:15 | #36

    That’s a pitty but
    notifyIcon.PreviewTrayToolTipOpen
    does not work in Windows 10.

  33. Dave
    July 12th, 2016 at 11:28 | #37

    Is there a licence associated with this code?

  34. Moreno
    July 26th, 2016 at 08:48 | #38

    Hi Phillip, how do I make the TrayPopup appear programmatically? A ShowTrayPopup() or similar method of the TaskbarIcon class would be helpful.
    Thanks for this project, it’s awesome!

  35. August 3rd, 2016 at 14:43 | #39

    Hello Philip. Aprox 4 days ago, I posted in the codeproject fórum a Little doubt about the Support of keyboard events on the icon.
    Currently, when someone press enter or spacebar when the icon is focused, it does nothing, or when someone press the aplication key. I’m blind, and I’m programing for blind people, and the answer of the icon to keyboard events are very important. How you can currently, make the icon answer to the keyboard events?
    The other question is about the context menu. I want open it, answering a keystrocke, but if I try to open the menu directly, the menu doesn’t appear. For get this behabior, I have to first, open a dummy window, and over it, open the menu. It Works fine, but sometimes, the window doesn’t get the focus, and the menu doesn’t appear, and as a result, i have a floating window that the user have to cloce manualli instead of the automatic clocing after the context menu. Well… how i can aboid this and open directly the menu, simulating a right key over the icon?

    Or how I can simulate a right key event over the icon, to launch the context menu :P.

    Ok, that is all. Thanks for all philip, and this userControl is simply awesome!

  36. Lionel
    August 8th, 2016 at 08:30 | #40

    Hi Philip,

    Tank you for your library, it’s working very good.
    But i still have 2 problems :

    – The first is when my app run at startup, the icon don’t appear in the traybar. My app is running, but i don’t have access to the menu via the traybar icon.

    – The second is like Dojo said before at April 30, 2014. I use MessageBox, but it appears only a fraction of a second and after it closes with a default return value. Is would like to use a MessageBox in the override function “Execute” in the class “CloseWindowCommand : CommandBase”.

    Do you have some solutions for my problems?
    Tank you in advanced.

  37. Mr. Smith
    September 18th, 2016 at 12:02 | #41

    Um, okay, never mind my last comment. Looks like it’s fixed already. I used an older version from CodeProject :/

  38. Paul
    September 25th, 2016 at 16:35 | #42

    Philipp, thank you for this great package. It is easy to use and looks beautifully. I am having trouble getting version 1.0.8 through nuget. If I select the package highlighted in the screenshot http://prnt.sc/cm6xib
    it installs into a folder that has 1.0.8 in the name, but right-clicking on the DLL and selecting Properties shows version 1.0.5.

    Also what is the SignedBuild package? Is there version 1.0.8 of the signed package?

    Thank you
    Paul

    • September 26th, 2016 at 07:35 | #43

      Paul, I just forgot to update the version number in AssemblyInfo.cs – the binaries are up-to-date, so don’t worry. I’ll fix this with the next version.

  39. Lionel
    September 28th, 2016 at 14:01 | #44

    Hi Philipp,

    Tank you for your library. but i have 2 problems.
    The first, as already mentioned Dojo is a bug when calling a “Messagebox”

    Dojo :
    I have a menuitem in contextmenu for the trayicon.
    menuitem just shows a MessageBox when clicked.
    Problem is, MessageBox flashes and disappears very quickly.
    Why is this?

    The second, that’s when my application is automatically executed when starting the PC, the icon does not appear in the traybar. Do you know how to fix this?

    Is it planned to fix these problems in the next version?

    Thank you in advance
    Lionel

  40. September 30th, 2016 at 14:11 | #45

    Sorry for send again this messaje, but you don’t aprove it t-t
    Hello Philip. Aprox 4 days ago, I posted in the codeproject fórum a Little doubt about the Support of keyboard events on the icon.
    Currently, when someone press enter or spacebar when the icon is focused, it does nothing, or when someone press the aplication key. I’m blind, and I’m
    programing for blind people, and the answer of the icon to keyboard events are very important. How you can currently, make the icon answer to the keyboard
    events?
    The other question is about the context menu. I want open it, answering a keystrocke, but if I try to open the menu directly, the menu doesn’t appear.
    For get this behabior, I have to first, open a dummy window, and over it, open the menu. It Works fine, but sometimes, the window doesn’t get the focus,
    and the menu doesn’t appear, and as a result, i have a floating window that the user have to cloce manualli instead of the automatic clocing after the
    context menu. Well… how i can aboid this and open directly the menu, simulating a right key over the icon?

    Or how I can simulate a right key event over the icon, to launch the context menu :P.

    Ok, that is all. Thanks for all philip, and this userControl is simply awesome!

  41. Miley
    October 12th, 2016 at 21:18 | #46

    I have a 64bit app using WPF NotifyIcon that stopped working after upgrading to Windows 10 64bit. Turns out the issue was that the CreateWindowEx was failing in the DefaultWindowProc due to the way that CreateWindow new handles creating the CreateStruct post Windows 7 64bit.

    This was happening because the WPARAM and LPARAMS were being defined as uint which is defined in C# as 32bit ints not cpu architecture bit width which was causing the pointer to the CreateStruct passed to the WM_NCCREATE/WM_CREATE WPARAM to be a 32bit pointer to garbage leading to DefWindowProc returning failure.

    The correct fix for this is to:
    * change WinApi.cs def of DefWindowProc to use IntPtr for wparam and lparam.
    * change WindowClass.cs def of WinddowProcedureHandler to use IntPtr for wparam and lparam
    * change WindowMessageSink.cs def of OnWindowMessageRecieved && ProcessWindowMessage to use IntPtr for wparam and lparam.
    * change ProcessWindowMessage switch on lparam to lparam.ToInt32()

  42. Dojo
    November 22nd, 2016 at 23:38 | #47

    Thought i contribute to a great control;

    ICON FROM PNG RESOURCE

    StreamResourceInfo sri = GetResourceStream(new Uri(“pack://application:,,,/ScreenScraper;component/Resources/image.png”));
    if (sri != null)
    {
    Bitmap bmp = new Bitmap(sri.Stream);
    if (_notifyIcon != null) _notifyIcon.Icon = Icon.FromHandle(bmp.GetHicon());
    }

  43. Joba
    November 23rd, 2016 at 14:14 | #48

    Is there a way to show multiple custom ballon tips?

  44. Mark Lyons
    November 29th, 2016 at 21:43 | #49

    Might be a dumb question, as I don’t understand namespaces all that well….

    But lets sat I decide to use your notifyIcon and you have this name-space in the xaml:
    xmlns:tb=”http://www.hardcodet.net/taskbar”

    What happens if the site goes down? Or you decide to go pursue another hobby…

    Will my code stop working?

    Thanks for your hard work on this, this looks amazing!!

  45. Micheal
    December 24th, 2016 at 08:58 | #50

    Hi Philipp.I have a error with hardcodet.notifyicon.wpf library.I give XamlParseException error when i use taskbar library.
    What case this?.I have not solved problem.I wait your help.I thank you….

  46. Bradley
    February 23rd, 2017 at 05:07 | #51

    @Mark Lyons
    Nothing, that isn’t a “real” URL, it’s just an identifier that associates the assembly containing this library with the namespace “tb”. It could in theory be anything, but the author of this library picked something that looks like a URL. The computer will never try to pull any resources from that URL because of it being in the xmlns.

Comment pages
1 4 5 6 7 452
  1. November 20th, 2015 at 18:06 | #1
  2. April 1st, 2016 at 18:09 | #2
  3. April 2nd, 2016 at 07:07 | #3