<UserControl
    x:Class="BasicLibrarySamples.View.ContextMenu"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BasicLibrarySamples.View"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c1="using:C1.Xaml"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    <UserControl.Resources>

        <Style TargetType="Image" x:Key="MenuIcon">
            <Setter Property="Width" Value="16"/>
            <Setter Property="Height" Value="16"/>
            <Setter Property="Margin" Value="5 0 0 0"/>
        </Style>
        <Style TargetType="TextBlock" x:Key="TextIconStyle">
            <Setter Property="FontSize" Value="20" />
            <Setter Property="FontFamily" Value="Segoe UI Symbol" />
            <Setter Property="FontWeight" Value="Normal" />
            <!--<Setter Property="Foreground" Value="{StaticResource AppBarItemForegroundThemeBrush}" />-->
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <!--<Setter Property="Margin" Value="5,0"/>-->
        </Style>
     </UserControl.Resources>
    <Grid>
        <Border Background="LemonChiffon"
                MinHeight="40" BorderBrush="#969696" BorderThickness="1" Padding="5" 
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <c1:C1ContextMenuService.ContextMenu>
                <c1:C1ContextMenu x:Name="contextMenu" ItemClick="contextMenu_ItemClick">
                    <c1:C1ContextMenu.ItemContainerTransitions>
                        <TransitionCollection>
                            <EntranceThemeTransition FromVerticalOffset="10" FromHorizontalOffset="0" IsStaggeringEnabled="False"/>
                        </TransitionCollection>
                    </c1:C1ContextMenu.ItemContainerTransitions>
                    <c1:C1MenuItem Header="Add">
                        <c1:C1MenuItem.ItemContainerTransitions>
                            <TransitionCollection>
                                <EntranceThemeTransition FromVerticalOffset="10" FromHorizontalOffset="0" IsStaggeringEnabled="False"/>
                            </TransitionCollection>
                        </c1:C1MenuItem.ItemContainerTransitions>
                        <c1:C1MenuItem Header="New Item">
                            <c1:C1MenuItem.Icon>
                                <TextBlock Text="&#xE1DA;" Style="{StaticResource TextIconStyle}" />
                            </c1:C1MenuItem.Icon>
                        </c1:C1MenuItem>
                        <c1:C1MenuItem Header="Existing Item"/>
                        <c1:C1MenuItem Header="Folder"/>
                        <c1:C1Separator />
                        <c1:C1MenuItem Header="Class"/>
                    </c1:C1MenuItem>
                    <c1:C1Separator />
                    <c1:C1MenuItem Header="Exclude From Project"/>
                    <c1:C1Separator />
                    <c1:C1MenuItem Header="Cut">
                        <c1:C1MenuItem.Icon>
                            <TextBlock Text="&#xE16B;" Style="{StaticResource TextIconStyle}" />
                        </c1:C1MenuItem.Icon>
                    </c1:C1MenuItem>
                    <c1:C1MenuItem Header="Copy">
                        <c1:C1MenuItem.Icon>
                            <TextBlock Text="&#xE16F;" Style="{StaticResource TextIconStyle}" />
                        </c1:C1MenuItem.Icon>
                    </c1:C1MenuItem>
                    <c1:C1MenuItem Header="Paste">
                        <c1:C1MenuItem.Icon>
                            <TextBlock Text="&#xE16D;" Style="{StaticResource TextIconStyle}" />
                        </c1:C1MenuItem.Icon>
                    </c1:C1MenuItem>
                    <c1:C1MenuItem Header="Delete">
                        <c1:C1MenuItem.Icon>
                            <TextBlock Text="&#xE107;" Style="{StaticResource TextIconStyle}" />
                        </c1:C1MenuItem.Icon>
                    </c1:C1MenuItem>
                    <c1:C1MenuItem Header="Rename"/>
                    <c1:C1Separator/>
                    <c1:C1MenuItem Header="Properties"/>
                </c1:C1ContextMenu>
            </c1:C1ContextMenuService.ContextMenu>
            <!-- Note: keyboard events such as pressing Application key only work if visual tree contains some focusable control.
                 So, if we remove C1ListViewer and only leave TexBlock element, context menu won't be shown on Application key. -->
            <c1:C1ListViewer HorizontalAlignment="Stretch" VerticalAlignment="Center" ZoomMode="Disabled" >
                <TextBlock Text="Touch: hold down for a few seconds until the indicator displays.&#10;Keyboard: press the context-menu button over this text.&#10;Mouse: right-click over this text." 
                           TextWrapping="Wrap" Foreground="Sienna" FontSize="16" />
            </c1:C1ListViewer>
        </Border>
        <TextBlock x:Name="txt" Foreground="Red" Text="" FontSize="16" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="10" />
    </Grid>
</UserControl>
