<UserControl x:Class="Outline.OutlineWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:out="clr-namespace:Outline"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <StackPanel>
        <TreeView Name="TreeView" Height="300">
            <TreeView.Resources>
                <HierarchicalDataTemplate DataType="{x:Type out:OutlineTreeItem}" ItemsSource="{Binding Path=Items}">
                    <TextBlock Text="{Binding Path=Header}"/>
                </HierarchicalDataTemplate>
            </TreeView.Resources>
            <TreeView.ItemContainerStyle>
                <Style TargetType="{x:Type TreeViewItem}">
                    <EventSetter Event="TreeViewItem.MouseDoubleClick" Handler="treeView_MouseDoubleClick"/>
                    <Setter Property="ContextMenu">
                        <Setter.Value>
                            <ContextMenu>
                                <MenuItem Header="切り取り" Command="{x:Static out:OutlineCommands.Cut}"/>
                                <MenuItem Header="コピー" Command="{x:Static out:OutlineCommands.Copy}"/>
                                <MenuItem Header="子として貼り付け" Command="{x:Static out:OutlineCommands.PasteAsChild}"/>
                                <Separator/>
                                <MenuItem Header="レベルを一つ上げる" Command="{x:Static out:OutlineCommands.UpLevel}"/>
                                <MenuItem Header="レベルを一つ下げる" Command="{x:Static out:OutlineCommands.DownLevel}"/>
                            </ContextMenu>
                        </Setter.Value>
                    </Setter>
                </Style>
            </TreeView.ItemContainerStyle>
        </TreeView>
    </StackPanel>
</UserControl>
