Author Topic: SOLVED: SystemTray customization in WDE  (Read 2093 times)

Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
SOLVED: SystemTray customization in WDE
« on: March 21, 2017, 04:46:12 PM »
Let's talk about Window: SystemTrayView (ISystemTrayContextMenu) <ref name="Windows" />

In the documentation, there is a screenshot of a customized systemtray but nothing about how we add item on it

Do you have information to share?

Thank you
« Last Edit: March 23, 2017, 01:10:09 PM by petitspirou »

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: SystemTray customization in WDE
« Reply #1 on: March 22, 2017, 10:43:49 AM »
Try this:




[code]            container.RegisterType<ICustomMenuView, CustomMenuView>();
            try
            {
                viewManager.ViewsByRegionName["SystemTrayFreeMenuItemsRegion"].Insert(0,
                    new ViewActivator()
                    {
                        ViewType = typeof(ICustomMenuView),
                        ViewName = "CustomMenuView",
                        ActivateView = true
                    });
            }
            catch(Exception e)
            {
                log.Error("Error SystemTrayMenuItem", e);
            }[/code]

Where CustomMenuView is like this:

[code]<MenuItem x:Class="WDEScratchPad.CustomViews.CustomMenuView"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:localization="clr-namespace:Tomers.WPF.Localization;assembly=Tomers.WPF.Localization"
xmlns:loc="http://schemas.tomer.com/winfx/2006/xaml/presentation"
Header="Test Menu" Click="MenuItem_Click">

</MenuItem>[/code]

Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: SystemTray customization in WDE
« Reply #2 on: March 23, 2017, 01:09:29 PM »
It is Working fine
Thank you