From d1f6b5f7a0c1892bef05bcb00ec06f63337f01bb Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Fri, 18 Sep 2020 23:41:10 +0800 Subject: [PATCH] fixed #476 --- .../HandyControl_Shared/Controls/Other/NotifyIcon.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs b/src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs index c70f68dc..f6217057 100644 --- a/src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs +++ b/src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs @@ -270,6 +270,11 @@ namespace HandyControl.Controls var ctl = (NotifyIcon)d; ctl._icon = (ImageSource)e.NewValue; ctl.OnIconChanged(); + + if (!string.IsNullOrEmpty(ctl._windowClassName) && !ctl.IsBlink && ctl.Visibility == Visibility.Visible) + { + ctl.UpdateIcon(true); + } } public ImageSource Icon @@ -491,6 +496,8 @@ namespace HandyControl.Controls private void OnIconChanged() { + if (_windowClassName == null) return; + if (_icon != null) { IconHelper.GetIconHandlesFromImageSource(_icon, out _, out _iconHandle);