Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System.Windows;
using System.Windows.Input;
using Hardcodet.Wpf.TaskbarNotification;

namespace NotifyIconWpf.Sample.ShowCases.Commands
{
Expand All @@ -15,8 +16,12 @@ public class CloseWindowCommand : CommandBase<CloseWindowCommand>
{
public override void Execute(object parameter)
{
GetTaskbarWindow(parameter).Close();
CommandManager.InvalidateRequerySuggested();
if (parameter is TaskbarIcon taskbarIcon)
{
taskbarIcon.CloseTrayPopup();
GetTaskbarWindow(taskbarIcon).Close();
CommandManager.InvalidateRequerySuggested();
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Width="160">
CornerRadius="4">
<StackPanel>
<TextBox
x:Name="popupText"
Expand Down
9 changes: 9 additions & 0 deletions src/NotifyIconWpf/TaskbarIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ public void ShowCustomBalloon(UIElement balloon, PopupAnimation animation, int?
// fire attached event
RaiseBalloonShowingEvent(balloon, this);

// To apply DynamicResource changes (related to issue on GitHub for TaskbarIcon: https://github.com/hardcodet/wpf-notifyicon/issues/19)
popup.UpdateDefaultStyle();

// display item
popup.IsOpen = true;

Expand Down Expand Up @@ -676,6 +679,9 @@ public void ShowTrayPopup()
// place the popup
PlacePopup(PopupPlacement);

// To apply DynamicResource changes (related to issue on GitHub for TaskbarIcon: https://github.com/hardcodet/wpf-notifyicon/issues/19)
TrayPopupResolved.UpdateDefaultStyle();

// open popup
TrayPopupResolved.IsOpen = true;

Expand Down Expand Up @@ -747,6 +753,9 @@ private void ShowContextMenu(Point cursorPosition)
return;
}

// To apply DynamicResource changes (related to issue on GitHub for TaskbarIcon: https://github.com/hardcodet/wpf-notifyicon/issues/19)
ContextMenu.UpdateDefaultStyle();

// use absolute positioning. We need to set the coordinates, or a delayed opening
// (e.g. when left-clicked) opens the context menu at the wrong place if the mouse
// is moved!
Expand Down