<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:c1="using:C1.Xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ms-appx:///C1.UWP/themes/Common.xaml"/>
        <ResourceDictionary Source="ms-appx:///C1.UWP/themes/C1ScrollBar.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!--******************** C1TreeView ********************-->

    <!-- CornerRadius @ TreeViewItem -->
    <CornerRadius x:Key="TreeViewItemCornerRadius">0</CornerRadius>

    <!-- Style @ TreeViewToggle Collapsed Icon -->
    <Style x:Key="TreeViewCollapsedIconStyle" TargetType="Path">
        <Setter Property="RenderTransform">
            <Setter.Value>
                <TransformGroup>
                    <RotateTransform Angle="-45" CenterX="3" CenterY="3"/>
                </TransformGroup>
            </Setter.Value>
        </Setter>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>


    <!-- ToggleButton @ C1TreeView Expand/Collapse Icon -->
    <ControlTemplate x:Key="C1TreeViewToggle" TargetType="c1:C1TreeViewExpandButton" >
        <Grid Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates" >
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="PointerOver" />
                    <VisualState x:Name="Pressed" />
                    <VisualState x:Name="Disabled" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="CheckStates" >
                    <VisualState x:Name="Checked">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ExpandedGrid" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="CollapsedGrid" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="CheckedPointOver">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ExpandedGrid" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="CollapsedGrid" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Indeterminate" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="ShowIcons">
                    <VisualState x:Name="ShowTriangleIcon">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ExpandedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LineExpandedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="CollapsedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LineCollapsedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="ShowPlusIcon">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ExpandedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LineExpandedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="CollapsedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LineCollapsedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates" >
                    <VisualState x:Name="Unfocused">
                    </VisualState>
                    <VisualState x:Name="Focused">
                    </VisualState>
                    <VisualState x:Name="PointerFocused">
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid x:Name="ExpandedGrid" Height="32" Width="32">
                <Path x:Name="ExpandedIcon" Data="M5.9130435,0.086956523 L5.9130435,5.9130435 L0.086956523,5.9130435 z"
		            Fill="{TemplateBinding Background}" Width="12" Height="12" Stretch="UniformToFill"
                    VerticalAlignment="Center"/>
                <Grid x:Name="LineExpandedIcon" Visibility="Collapsed" Background="{ThemeResource TextBoxBackgroundThemeBrush}" Width="22" Height="22">
                    <Rectangle StrokeThickness="2" Stroke="{ThemeResource CheckBoxForegroundThemeBrush}" Opacity="0.4"/>
                    <Rectangle Fill="{ThemeResource CheckBoxForegroundThemeBrush}" Width="10" Height="2"/>
                </Grid>
            </Grid>
            <!-- Collapse visual -->
            <Grid x:Name="CollapsedGrid" Height="32" Width="32">
                <Path x:Name="CollapsedIcon" Data="M5.9130435,0.086956523 L5.9130435,5.9130435 L0.086956523,5.9130435 z"
            		Fill="{TemplateBinding Background}" Width="12" Height="12" Stretch="UniformToFill"
            		Style="{StaticResource TreeViewCollapsedIconStyle}" Opacity="0.5" Margin="0 6 6 0"/>
                <Grid x:Name="LineCollapsedIcon" Visibility="Collapsed" Background="{ThemeResource TextBoxBackgroundThemeBrush}" Width="22" Height="22">
                    <Rectangle StrokeThickness="2" Stroke="{ThemeResource CheckBoxForegroundThemeBrush}" Opacity="0.4"/>
                    <Path Data="M4,0 L6,0 L6,4 L10,4 L10,6 L6,6 L6,10 L4,10 L4,6 L0,6 L0,4 L4,4 z" Width="10" Height="10" Fill="{ThemeResource CheckBoxForegroundThemeBrush}" Stretch="Fill" />
                </Grid>
            </Grid>
       </Grid>
    </ControlTemplate>

    <!-- C1TreeView -->
    <Style TargetType="c1:C1TreeView">
        <Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}"/>
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
        <Setter Property="MouseOverBrush" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
        <Setter Property="SelectedBackground" Value="{ThemeResource ListViewItemDragBackgroundThemeBrush}"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1:C1TreeView">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled" >
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PointerOver" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="Focused">
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid"/>
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationDecorator" Storyboard.TargetProperty="ValidationState">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <c1:ValidationState>InvalidUnfocused</c1:ValidationState>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused" >
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationDecorator" Storyboard.TargetProperty="ValidationState">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <c1:ValidationState>InvalidFocused</c1:ValidationState>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="DropLine" Height="32">
                            <Path  Data="M5,4 L26,4" Stretch="Fill" 
		                        Height="1" Width="50"
		                        Stroke="{TemplateBinding SelectedBackground}"
		                        StrokeThickness="1" 
		                        VerticalAlignment="Center"/>
                            <Path Data="M0,0 L0,14 L14,7 z" Stretch="Fill"
		                        Height="9" Width="4" 
		                        HorizontalAlignment="Left" 
		                        Margin="0,0,2,0" 
		                        Fill="{TemplateBinding SelectedBackground}"/>
                        </Grid>
                        <Grid x:Name="DropArrow" >
                            <Path Data="M0,0 L0,14 L14,7 z" Stretch="Fill"
		                        Height="9" Width="4" 
		                        HorizontalAlignment="Right" 
		                        Margin="0,0,2,0" 
		                        Fill="{TemplateBinding SelectedBackground}"/>
                        </Grid>
                        <Border Background="{TemplateBinding Background}" 
		                    BorderThickness="{TemplateBinding BorderThickness}" 
		                    BorderBrush="{TemplateBinding BorderBrush}" 
		                    CornerRadius="{StaticResource GeneralCornerRadius}">
                            <ScrollViewer x:Name="Scroll" 
                                      ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}"
                                      HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" 
                                      VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" 
                                      IsTabStop="False" 
                                      BorderThickness="0"
                                              Foreground="Red"
                                      Padding="{TemplateBinding Padding}"
                                      Style="{StaticResource ScrollViewerClearStyle}"
	                                  c1:ClearStyleExtensions.ScrollBarStyle="{Binding Path=ScrollBarStyle,RelativeSource={RelativeSource TemplatedParent}}">
                                <ItemsPresenter />
                            </ScrollViewer>
                        </Border>
                        <Border x:Name="DisabledVisualElement" 
		                    Background="{StaticResource DisabledBrush}"
		                    CornerRadius="{StaticResource GeneralCornerRadius}"
		                    IsHitTestVisible="False"
		                    Opacity="0"
		                    Visibility="{TemplateBinding DisabledCuesVisibility}"/>
                        <c1:C1ValidationDecorator x:Name="ValidationDecorator" 
		                    Target="{Binding RelativeSource={RelativeSource TemplatedParent}}" 
		                    Style="{TemplateBinding ValidationDecoratorStyle}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Lines -->
    <Style x:Key="VerticalLineStyle" TargetType="c1:C1TreeViewLine">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1:C1TreeViewLine">
                    <Line x:Name="Line" Margin="2 0 0 0" Width="32" StrokeThickness="{TemplateBinding StrokeThickness}" Y2="{TemplateBinding Height}" X1="16" Y1="0" X2="16"
                          Stroke="{TemplateBinding Stroke}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="ExclusiveItemLineTemplate" TargetType="c1:C1TreeViewLine">
        <Path x:Name="Line" Width="32" Height="32" Data="M 16,16 L 32,16" Stroke="{TemplateBinding Stroke}" StrokeThickness="{TemplateBinding StrokeThickness}"></Path>
    </ControlTemplate>

    <ControlTemplate x:Key="RootItemLineTemplate" TargetType="c1:C1TreeViewLine">
        <Path x:Name="Line" Width="32" Height="32" Data="M 16,32 L 16,16 L 16,16" Stroke="{TemplateBinding Stroke}" StrokeThickness="{TemplateBinding StrokeThickness}"></Path>
    </ControlTemplate>

    <ControlTemplate x:Key="NormalItemLineTemplate" TargetType="c1:C1TreeViewLine">
        <Path x:Name="Line" Width="32" Height="32" Data="M 16,0 L 16,32 M 16,16 L 32,16" Stroke="{TemplateBinding Stroke}" StrokeThickness="{TemplateBinding StrokeThickness}"></Path>
    </ControlTemplate>

    <ControlTemplate x:Key="LastItemLineTemplate" TargetType="c1:C1TreeViewLine">
        <Path x:Name="Line" Width="32" Height="32" Data="M 16,0 L 16,16 L 32,16" Stroke="{TemplateBinding Stroke}" StrokeThickness="{TemplateBinding StrokeThickness}"></Path>
    </ControlTemplate>

    <!-- C1TreeViewItem -->
    <Style TargetType="c1:C1TreeViewItem">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1:C1TreeViewItem">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectedStates">
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="SelectedElement" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpandedStates">
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ChildrenPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ChildrenPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <!--Show/Hide connecting lines-->
                            <VisualStateGroup x:Name="ShowLinesStates">
                                <VisualState x:Name="ShowLines">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LinePanel" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ItemLine" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="HideLines">
                                   <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LinePanel" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ItemLine" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <!--Show L line or T line according to whether the item is last-->
                            <VisualStateGroup x:Name="ItemLineStates">
                                <VisualState x:Name="ShowExclusiveItemLine">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ItemLine" Storyboard.TargetProperty="(Control.Template)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource NormalItemLineTemplate}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LinePanel" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ShowRootItemLine">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ItemLine" Storyboard.TargetProperty="(Control.Template)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource NormalItemLineTemplate}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LinePanel" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ShowLastItemLine">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ItemLine" Storyboard.TargetProperty="(Control.Template)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource NormalItemLineTemplate}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LinePanel" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ShowNormalItemLine">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="ItemLine" Storyboard.TargetProperty="(Control.Template)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource NormalItemLineTemplate}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="LinePanel" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Border x:Name="SelectedElement"
		                    Background="{TemplateBinding SelectedBackground}" 
		                    CornerRadius="{StaticResource TreeViewItemCornerRadius}" 
		                    Visibility="Collapsed"/>
                        <Border x:Name="MouseOverElement"
		                    Background="{TemplateBinding MouseOverBrush}" 
		                    Opacity="{ThemeResource TextControlPointerOverBorderThemeOpacity}"
		                    CornerRadius="{StaticResource TreeViewItemCornerRadius}" 
		                    Visibility="Collapsed"/>
                        <Grid x:Name="HeaderPanelContainer" Background="Transparent" Margin="2 0">
                            <Grid x:Name="HeaderPanel" MinHeight="32" Background="Transparent">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"  MinWidth="11"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <c1:C1TreeViewLine x:Name="ItemLine" Visibility="Collapsed"
                                                   Width="32" Height="32" Stroke="{TemplateBinding LineStroke}" 
                                                   StrokeThickness="{TemplateBinding LineThickness}" StrokeDashArray="{TemplateBinding LineDashArray}"/>
                                <c1:C1TreeViewExpandButton x:Name="ExpandButton"
		                            Background="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding Foreground}" 
                                    IsTabStop="{TemplateBinding IsTabStop}" VerticalAlignment="Center" Margin="0" Template="{StaticResource C1TreeViewToggle}"/>

                                <ContentControl x:Name="Header" Grid.Column="1"
                                    IsTabStop="{TemplateBinding IsTabStop}"
		                            ContentTemplate="{TemplateBinding HeaderTemplate}"
		                            FontFamily="{TemplateBinding FontFamily}"
		                            FontSize="{TemplateBinding FontSize}"
		                            FontStretch="{TemplateBinding FontStretch}"
		                            FontStyle="{TemplateBinding FontStyle}"
		                            FontWeight="{TemplateBinding FontWeight}"
		                            Foreground="{TemplateBinding Foreground}"
		                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
		                            Padding="{TemplateBinding Padding}"
		                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}">
                                </ContentControl>
                            </Grid>
                            <Border x:Name="DisabledVisualElement" Background="{StaticResource DisabledBrush}" CornerRadius="{StaticResource GeneralCornerRadius}"
		                        IsHitTestVisible="False" Visibility="Collapsed"/>
                        </Grid>
                        <Grid Grid.Row="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="32"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <!-- Vertical Line -->
                            <c1:C1TreeViewLinePanel x:Name="LinePanel" LineStroke="{TemplateBinding LineStroke}" LineThickness="{TemplateBinding LineThickness}" 
                                                    LineDashArray="{TemplateBinding LineDashArray}" LineStyle="{StaticResource VerticalLineStyle}" Visibility="Collapsed"/>
                            <ItemsPresenter x:Name="ChildrenPanel" Grid.Column="1"/>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>
