<Window x:Class="WinUI.ToolbarItem"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WinUI"
        xmlns:tb="http://www.hardcodet.net/taskbar"
        xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
        mc:Ignorable="d"
        Height="300" Width="300" Visibility="Hidden" Name="Toolbar">

    <Window.Resources>
        <CollectionViewSource Source="{Binding ElementName=Toolbar, Path=NetworkCollection}" x:Key="KnownNetworks">
            <CollectionViewSource.SortDescriptions>
                <scm:SortDescription PropertyName="Header" Direction="Ascending"/>
            </CollectionViewSource.SortDescriptions>
        </CollectionViewSource>   
    </Window.Resources>
    
    <Grid>
        <tb:TaskbarIcon x:Name="MyNotifyIcon"
                        IconSource="ZeroTierIcon.ico"
                        ToolTipText="ZeroTier One"
												MenuActivation="LeftOrRightClick">
            <tb:TaskbarIcon.ContextMenu>
                <ContextMenu>
					<ContextMenu.ItemsSource>
						<CompositeCollection>
							<MenuItem Header="Node ID: unknown"
                                      Click="ToolbarItem_NodeIDClicked"
                                      x:Name="nodeIdMenuItem"/>
							<Separator/>
							<MenuItem Header="Join Network..."
                                      Click="ToolbarItem_JoinNetworkClicked"/>
							<MenuItem Header="Show Networks..."
                                      Click="ToolbarItem_ShowNetworksClicked"/>
							<Separator/>

							<CollectionContainer Collection="{Binding Source={StaticResource KnownNetworks}}">

							</CollectionContainer>

							<Separator/>
							<MenuItem Header="About..."
                                      Click="ToolbarItem_AboutClicked"/>
							<MenuItem Header="Preferences..."
                                      Click="ToolbarItem_PreferencesClicked"/>
							<Separator/>
							<MenuItem Header="Quit"
                                      Click="ToolbarItem_QuitClicked"/>

						</CompositeCollection>
					</ContextMenu.ItemsSource>
				</ContextMenu>
            </tb:TaskbarIcon.ContextMenu>

        </tb:TaskbarIcon>
    </Grid>
</Window>
