Skip to content

Commit e384557

Browse files
committed
Add SetTheme method in SystemTrayIcon #154
1 parent d5aa86f commit e384557

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

dev/DevWinUI/Common/TrayIcon/SystemTrayIcon.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,13 @@ public void SetIcon(IconId iconId)
238238
if (IsVisible)
239239
UpdateIcon();
240240
}
241-
241+
public void SetTheme(ElementTheme elementTheme)
242+
{
243+
if (_window != null && _window.Content is FrameworkElement element)
244+
{
245+
element.RequestedTheme = elementTheme;
246+
}
247+
}
242248
private void AddToTray(uint iconId)
243249
{
244250
if (currentIcon.Value == 0) // Fallback to default icon

0 commit comments

Comments
 (0)