<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:tb="http://www.hardcodet.net/taskbar"
    xmlns:local="clr-namespace:NotifyIconWpf.Sample.Windowless"
    >

    <!--  The taskbar context menu - the first row is a dummy to show off simple data binding  -->
    <!--
        The "shared" directive is needed if we reopen the sample window a few times - WPF will otherwise
        reuse the same context menu (which is a resource) again (which will have its DataContext set to the old TaskbarIcon)
    -->
    <ContextMenu
        x:Shared="false"
        x:Key="SysTrayMenu"
        >
        <MenuItem
            Header="Show Window"
            Command="{Binding ShowWindowCommand}"
            />
        <MenuItem
            Header="Hide Window"
            Command="{Binding HideWindowCommand}"
            />
        <Separator />
        <MenuItem
            Header="Exit"
            Command="{Binding ExitApplicationCommand}"
            />
    </ContextMenu>


    <!--  the application's NotifyIcon - started from App.xaml.cs. Declares its own view model.  -->
    <tb:TaskbarIcon
        x:Key="NotifyIcon"
        IconSource="/Red.ico"
        ToolTipText="Left-click to show window, right-click for menu"
        LeftClickCommand="{Binding ShowWindowCommand}"
        NoLeftClickDelay="True"
        ContextMenu="{StaticResource SysTrayMenu}"
        >

        <!--  self-assign a data context (could also be done programmatically)  -->
        <tb:TaskbarIcon.DataContext>
            <local:NotifyIconViewModel />
        </tb:TaskbarIcon.DataContext>
    </tb:TaskbarIcon>

</ResourceDictionary>