<Window
    x:Class="NotifyIconWpf.Sample.ShowCases.Tutorials.InlineContextMenuWindow"
    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:commands="clr-namespace:NotifyIconWpf.Sample.ShowCases.Commands"
    Height="300"
    Width="300"
    >
    <Grid>
        <tb:TaskbarIcon
            x:Name="MyNotifyIcon"
            ToolTipText="hello world"
            TrayContextMenuOpen="MyNotifyIcon_TrayContextMenuOpen"
            PreviewTrayContextMenuOpen="MyNotifyIcon_PreviewTrayContextMenuOpen"
            >
            <tb:TaskbarIcon.IconSource>
                <tb:GeneratedIconSource
                    Text="❤️"
                    BorderThickness="5"
                    FontSize="36"
                    >
                    <tb:GeneratedIconSource.Foreground>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="128,128">
                            <GradientStop Color="White" />
                            <GradientStop Color="Red" />
                        </LinearGradientBrush>
                    </tb:GeneratedIconSource.Foreground>
                    <tb:GeneratedIconSource.BorderBrush>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="128,128">
                            <GradientStop Color="White" />
                            <GradientStop Color="Red" />
                        </LinearGradientBrush>
                    </tb:GeneratedIconSource.BorderBrush>
                </tb:GeneratedIconSource>
            </tb:TaskbarIcon.IconSource>

            <!--  Set a simple context menu  -->
            <!--  the data context of the context menu is the NotifyIcon itself (see more about this in DataBinding samples)  -->
            <tb:TaskbarIcon.ContextMenu>
                <ContextMenu>
                    <TextBlock Text="Hiding the sample window will not close it!" />
                    <MenuItem
                        Header="_Show Sample Window [S]"
                        Command="{commands:ShowSampleWindowCommand}"
                        CommandParameter="{Binding}"
                        >
                        <MenuItem.Icon>
                            <Image
                                Width="16"
                                Height="16"
                                Source="/Images/Add.png"
                                />
                        </MenuItem.Icon>
                    </MenuItem>

                    <Separator />

                    <MenuItem
                        Header="_Hide Sample Window [H]"
                        Command="{commands:HideSampleWindowCommand}"
                        CommandParameter="{Binding}"
                        >
                        <MenuItem.Icon>
                            <Image
                                Width="16"
                                Height="16"
                                Source="/Images/Remove.png"
                                />
                        </MenuItem.Icon>
                    </MenuItem>
                </ContextMenu>
            </tb:TaskbarIcon.ContextMenu>

        </tb:TaskbarIcon>
        <TextBlock
            Margin="26,26,24,0"
            VerticalAlignment="Top"
            FontWeight="Bold"
            TextWrapping="Wrap"
            >
            <Run
                Language="de-ch"
                Text="Right-click on NotifyIcon to open Context Menu"
                />
        </TextBlock>
        <TextBlock
            HorizontalAlignment="Left"
            Margin="26,83,0,0"
            TextWrapping="Wrap"
            Text="Context menu preview open events:"
            VerticalAlignment="Top"
            />
        <TextBlock
            HorizontalAlignment="Left"
            Margin="26,103.96,0,0"
            TextWrapping="Wrap"
            Text="Context menu open events:"
            VerticalAlignment="Top"
            />
        <TextBlock
            x:Name="PreviewOpenEventCounter"
            HorizontalAlignment="Left"
            Margin="246,83,0,0"
            TextWrapping="Wrap"
            Text="0"
            VerticalAlignment="Top"
            />
        <TextBlock
            x:Name="OpenEventCounter"
            HorizontalAlignment="Left"
            Margin="246,106.97,0,0"
            TextWrapping="Wrap"
            Text="0"
            VerticalAlignment="Top"
            />
        <CheckBox
            x:Name="SuppressContextMenu"
            Content="Suppress context menu in preview event"
            HorizontalAlignment="Left"
            Margin="26,190,0,0"
            VerticalAlignment="Top"
            />
    </Grid>
</Window>