chirag goyal
chirag goyal

Reputation: 133

WinUI3 H.NotifyIcon, Unable to resolve symbol TaskbarIcon

I am working on a winui3 project, and for notify icon, only good option I found is HavenDV/H.NotifyIcon

For winui, it recommends H.NotifyIcon.WinUI, but it is having version issues and showing enter image description here

So, I tried to add the core library H.NotifyIcon, which supposedly works for all the platforms, but it is showing Unable to resolve symbol 'TaskbarIcon'

enter image description here

So, what I am doing wrong?

Upvotes: 0

Views: 545

Answers (2)

Jeaninez - MSFT
Jeaninez - MSFT

Reputation: 4040

I test it and I couldn't reproduce the issue.

1,In manage nuget packages, find the H.NotifyIcon.winui package and install it.

enter image description here

2,Declared within MainWindow

<Window
        xmlns:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf" // WPF
    xmlns:tb="using:H.NotifyIcon" // WinUI
    >
        <tb:TaskbarIcon
            ToolTipText="ToolTip"
        IconSource="/Images/TrayIcons/Logo.ico"
            ContextFlyout="{StaticResource TrayMenu}"
            MenuActivation="LeftOrRightClick"
            TrayPopup="{StaticResource TrayStatusPopup}"
            PopupActivation="DoubleClick"
            TrayToolTip="{StaticResource TrayToolTip}"
            />
</Window>

Note: 1,WinUI uses ContextFlyout instead ContextMenu.

2,Microsoft.WindowsAppSDK>=1.2.230217.4

For more details I suggest you could refer to the link:

https://github.com/HavenDV/H.NotifyIcon

Upvotes: 1

Andrew KeepCoding
Andrew KeepCoding

Reputation: 13816

From the error message, I guess you are getting this error because, the latest H.NotifyIcon.WinUI requires WindowsAppSDK v1.2.230217.4 or later, but your app has WindowsAppSDK v1.2.221109.1 installed.

Updating WindowsAppSDK to the latest version should fix your problem.

Upvotes: 1

Related Questions