<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dataconvert="clr-namespace:PDF_Office.DataConvert">

    <PathGeometry x:Key="TreeArrow" Figures="M508.893248 762.931659a65.039498 65.039498 0 0 1-46.420659-19.485839L97.125746 371.004022c-25.143018-25.634319-24.752868-66.816849 0.881451-91.959868 25.648769-25.164693 66.809624-24.745643 91.959867 0.881451l318.933409 325.125238 318.933408-325.125238a65.025048 65.025048 0 0 1 92.841318 91.078417L555.313907 743.44582a65.025048 65.025048 0 0 1-46.420659 19.485839z" />

    <PathGeometry x:Key="Ic_MoreButtonPath" Figures="M2,7 C2.140625,7 2.27083333,7.02604167 2.390625,7.078125 C2.51041667,7.13020833 2.61588542,7.20182292 2.70703125,7.29296875 C2.79817708,7.38411458 2.86979167,7.48958333 2.921875,7.609375 C2.97395833,7.72916667 3,7.859375 3,8 C3,8.140625 2.97395833,8.27083333 2.921875,8.390625 C2.86979167,8.51041667 2.79817708,8.61588542 2.70703125,8.70703125 C2.61588542,8.79817708 2.51041667,8.86979167 2.390625,8.921875 C2.27083333,8.97395833 2.140625,9 2,9 C1.859375,9 1.72916667,8.97395833 1.609375,8.921875 C1.48958333,8.86979167 1.38411458,8.79817708 1.29296875,8.70703125 C1.20182292,8.61588542 1.13020833,8.51041667 1.078125,8.390625 C1.02604167,8.27083333 1,8.140625 1,8 C1,7.859375 1.02604167,7.72916667 1.078125,7.609375 C1.13020833,7.48958333 1.20182292,7.38411458 1.29296875,7.29296875 C1.38411458,7.20182292 1.48958333,7.13020833 1.609375,7.078125 C1.72916667,7.02604167 1.859375,7 2,7 Z M8,7 C8.140625,7 8.27083333,7.02604167 8.390625,7.078125 C8.51041667,7.13020833 8.61588542,7.20182292 8.70703125,7.29296875 C8.79817708,7.38411458 8.86979167,7.48958333 8.921875,7.609375 C8.97395833,7.72916667 9,7.859375 9,8 C9,8.140625 8.97395833,8.27083333 8.921875,8.390625 C8.86979167,8.51041667 8.79817708,8.61588542 8.70703125,8.70703125 C8.61588542,8.79817708 8.51041667,8.86979167 8.390625,8.921875 C8.27083333,8.97395833 8.140625,9 8,9 C7.859375,9 7.72916667,8.97395833 7.609375,8.921875 C7.48958333,8.86979167 7.38411458,8.79817708 7.29296875,8.70703125 C7.20182292,8.61588542 7.13020833,8.51041667 7.078125,8.390625 C7.02604167,8.27083333 7,8.140625 7,8 C7,7.859375 7.02604167,7.72916667 7.078125,7.609375 C7.13020833,7.48958333 7.20182292,7.38411458 7.29296875,7.29296875 C7.38411458,7.20182292 7.48958333,7.13020833 7.609375,7.078125 C7.72916667,7.02604167 7.859375,7 8,7 Z M14,7 C14.140625,7 14.2708333,7.02604167 14.390625,7.078125 C14.5104167,7.13020833 14.6158854,7.20182292 14.7070313,7.29296875 C14.7981771,7.38411458 14.8697917,7.48958333 14.921875,7.609375 C14.9739583,7.72916667 15,7.859375 15,8 C15,8.140625 14.9739583,8.27083333 14.921875,8.390625 C14.8697917,8.51041667 14.7981771,8.61588542 14.7070313,8.70703125 C14.6158854,8.79817708 14.5104167,8.86979167 14.390625,8.921875 C14.2708333,8.97395833 14.140625,9 14,9 C13.859375,9 13.7291667,8.97395833 13.609375,8.921875 C13.4895833,8.86979167 13.3841146,8.79817708 13.2929688,8.70703125 C13.2018229,8.61588542 13.1302083,8.51041667 13.078125,8.390625 C13.0260417,8.27083333 13,8.140625 13,8 C13,7.859375 13.0260417,7.72916667 13.078125,7.609375 C13.1302083,7.48958333 13.2018229,7.38411458 13.2929688,7.29296875 C13.3841146,7.20182292 13.4895833,7.13020833 13.609375,7.078125 C13.7291667,7.02604167 13.859375,7 14,7 Z" />
    <PathGeometry x:Key="Ic_AddButtonPath" Figures="M8.5,2.5 L8.5,7.5 L13.5,7.5 L13.5,8.5 L8.5,8.5 L8.5,13.5 L7.5,13.5 L7.5,8.5 L2.5,8.5 L2.5,7.5 L7.5,7.5 L7.5,2.5 L8.5,2.5 Z" />
    <dataconvert:UnVisivleConvert x:Key="UnVisivleConvert" />
    <dataconvert:BoolToVisible x:Key="BoolToVisible" />

    <Style x:Key="FocusVisualRadius0Margin0">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle
                        Opacity=".6"
                        SnapsToDevicePixels="true"
                        Stroke="#757575"
                        StrokeDashArray="1 1"
                        StrokeThickness="2" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Width" Value="16" />
        <Setter Property="Height" Value="16" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Border
                        Width="16"
                        Height="16"
                        Padding="4"
                        Background="Transparent">
                        <Path
                            x:Name="ExpandPath"
                            Data="{StaticResource TreeArrow}"
                            Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=TreeViewItem}}"
                            RenderTransformOrigin="0.5,0.5"
                            Stretch="Uniform">
                            <Path.RenderTransform>
                                <RotateTransform Angle="-90" />
                            </Path.RenderTransform>
                        </Path>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="ExpandPath" Property="RenderTransform">
                                <Setter.Value>
                                    <RotateTransform Angle="0" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="OutLineItemStyle" TargetType="{x:Type TreeViewItem}">
        <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="10,0" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0Margin0}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" MinWidth="19" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition MinHeight="32" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Border
                            x:Name="Bd"
                            Grid.ColumnSpan="3"
                            Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                            <Grid>

                                <DockPanel x:Name="PART_DockPanel" LastChildFill="True">
                                    <ToggleButton
                                        x:Name="Expander"
                                        ClickMode="Press"
                                        IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
                                        Style="{StaticResource ExpandCollapseToggleStyle}" />
                                    <ContentPresenter
                                        x:Name="PART_Header"
                                        ContentSource="Header"
                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                </DockPanel>

                                <StackPanel
                                    Margin="0,0,0,0"
                                    Orientation="Horizontal"
                                    Visibility="{Binding IsInsertCurrentLayer, Converter={StaticResource BoolToVisible}}">
                                    <Ellipse
                                        Width="8"
                                        Height="8"
                                        HorizontalAlignment="Stretch"
                                        VerticalAlignment="Bottom"
                                        Fill="White"
                                        Stroke="#FF0078D7"
                                        StrokeThickness="1.5" />
                                    <Rectangle
                                        Width="{Binding ElementName=PART_DockPanel, Path=ActualWidth}"
                                        Height="1.5"
                                        Margin="-1,0,0,2"
                                        HorizontalAlignment="Stretch"
                                        VerticalAlignment="Bottom"
                                        Fill="#FF0078D7"
                                        StrokeDashArray="2" />
                                </StackPanel>
                            </Grid>
                        </Border>
                        <ItemsPresenter
                            x:Name="ItemsHost"
                            Grid.Row="1"
                            Grid.Column="1"
                            Grid.ColumnSpan="2" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="False">
                            <Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="HasItems" Value="False">
                            <Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="#1A477EDE" />
                            <Setter Property="Foreground" Value="Black" />
                        </Trigger>
                        <Trigger SourceName="Bd" Property="IsMouseOver" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="#1A000000" />
                            <Setter Property="Foreground" Value="Black" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True" />
                                <Condition Property="IsSelectionActive" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="VirtualizingPanel.IsVirtualizing" Value="True">
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel IsItemsHost="True" />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>