<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:c1="clr-namespace:C1.WPF" 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="/C1.WPF.4;component/themes/Common.xaml" />
        <ResourceDictionary Source="/C1.WPF.4;component/themes/C1ScrollBar.xaml" />
    </ResourceDictionary.MergedDictionaries>

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

	<!-- Brush @ TreeView Background -->
    <SolidColorBrush x:Key="TreeViewBackgroundBrush" Color="White" />
    <!-- Brush @ TreeViewItem Background on MouseOver -->
	<LinearGradientBrush x:Key="TreeViewItemMouseOverBrush" EndPoint="0.5,1" StartPoint="0.5,0">
		<GradientStop Color="#FFF1FBFF" Offset="0" />
		<GradientStop Color="#FFC5E3ED" Offset="1" />
	</LinearGradientBrush>
	<!-- Brush @ TreeViewItem Selected Background -->
	<LinearGradientBrush x:Key="TreeViewItemSelectedBackground" EndPoint="0.5,1" StartPoint="0.5,0">
		<GradientStop Color="#FFDEF3FA" Offset="0" />
		<GradientStop Color="#FFA8D4E3" Offset="1" />
	</LinearGradientBrush>

	<!-- CornerRadius @ TreeViewItem -->
	<CornerRadius x:Key="TreeViewItemCornerRadius">2</CornerRadius>
	<!-- Thickness @ TreeView -->
	<Thickness x:Key="TreeViewThickness">1</Thickness>

	<!-- Brush @ TreeViewItem Expanded Icon Background -->
	<SolidColorBrush x:Key="TreeViewExpandedIconBrush" Color="#FF181818" />
	<!-- Brush @ TreeViewItem Collapsed Icon Background -->
	<LinearGradientBrush x:Key="TreeViewCollapsedIconBrush" EndPoint="0.5,1" StartPoint="0.5,0">
		<GradientStop Color="#FF9D9D9D" Offset="0.42" />
		<GradientStop Color="#FF818181" Offset="0.576" />
	</LinearGradientBrush>
	<!-- Brush @ TreeViewItem Collapsed Icon Border -->
	<SolidColorBrush x:Key="TreeViewCollapsedIconBorderBrush" Color="#FF2B2B2B" />

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

	<!-- ToggleButton @ C1TreeView Expand/Collapse Icon -->
	<ControlTemplate x:Key="C1TreeViewToggle" TargetType="c1:C1TreeViewExpandButton">
		<Grid Cursor="Arrow" Background="Transparent">
			<VisualStateManager.VisualStateGroups>
				<VisualStateGroup x:Name="CommonStates">
					<VisualState x:Name="Normal" />
					<VisualState x:Name="MouseOver" />
					<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="Unchecked">
                        <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 x:Name="Focused"/>
                    <VisualState x:Name="ContentFocused"/>
                </VisualStateGroup>
			</VisualStateManager.VisualStateGroups>
			<c1:C1BrushBuilder x:Name="ExpandedIconBrush" Input="{TemplateBinding Background}" DesignBrush="{StaticResource TreeViewExpandedIconBrush}" DesignColor="{StaticResource ForegroundTextBoxColor}" />
			<c1:C1BrushBuilder x:Name="CollapsedIconBrush" Input="{TemplateBinding Background}" DesignBrush="{StaticResource TreeViewCollapsedIconBrush}" DesignColor="{StaticResource ForegroundTextBoxColor}" />
			<c1:C1BrushBuilder x:Name="CollapsedIconBorderBrush" Input="{TemplateBinding Background}" DesignBrush="{StaticResource TreeViewCollapsedIconBorderBrush}" DesignColor="{StaticResource ForegroundTextBoxColor}" />
            
            <Grid x:Name="ExpandedGrid">
                <Path x:Name="ExpandedIcon" Data="M5.9130435,0.086956523 L5.9130435,5.9130435 L0.086956523,5.9130435 z" Fill="{Binding Output, ElementName=ExpandedIconBrush}" Stroke="{TemplateBinding Background}" Width="6" Height="6" />
                <Path x:Name="LineExpandedIcon" Data="M9.5,10.5 L5.5,10.5 M3.5,6.5 L11.5,6.5 L11.5,14.5 L3.5,14.5 z" Fill="White" Stroke="{TemplateBinding Background}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-3,-5,0,0" Visibility="Collapsed" />
            </Grid>
            <!-- Collapse visual -->
            <Grid x:Name="CollapsedGrid">
			    <Path x:Name="CollapsedIcon" Data="M5.9130435,0.086956523 L5.9130435,5.9130435 L0.086956523,5.9130435 z" Fill="{Binding Output, ElementName=CollapsedIconBrush}" Stroke="{Binding Output, ElementName=CollapsedIconBorderBrush}" Style="{StaticResource TreeViewCollapsedIconStyle}" />
                <Path x:Name="LineCollapsedIcon" Data="M9.5,10.5 L5.5,10.5 M7.5,8.5 L7.5,12.5 M3.5,6.5 L11.5,6.5 L11.5,14.5 L3.5,14.5 z" Fill="White" Stroke="{Binding Output, ElementName=CollapsedIconBorderBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-3,-5,0,0" Visibility="Collapsed" />
            </Grid>
		</Grid>
	</ControlTemplate>

	<!-- C1TreeView -->
	<Style TargetType="c1:C1TreeView">
        <Setter Property="BorderBrush" Value="{StaticResource WpfInputBorderBrush}" />
        <Setter Property="MouseOverBrush" Value="{StaticResource WpfInputMouseOverBrush}" />
        <Setter Property="SelectedBackground" Value="{StaticResource WpfInputSelectedBackground}" />
		<Setter Property="BorderThickness" Value="{StaticResource TreeViewThickness}" />
		<Setter Property="Background" Value="{StaticResource TreeViewBackgroundBrush}" />
		<Setter Property="Foreground" Value="{StaticResource ForegroundTextBoxBrushColor}" />
		<Setter Property="Padding" Value="6 2" />
        <Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"></Setter>
        <Setter Property="ScrollBarStyle" Value="{StaticResource ScrollBarClearStyle}" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="c1:C1TreeView">
                    <Grid x:Name="Root" Background="{TemplateBinding Background}" >
						<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="MouseOver" />
							</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">
							<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 BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{StaticResource GeneralCornerRadius}">
                            <ScrollViewer x:Name="Scroll" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" IsTabStop="False" BorderThickness="0" Padding="{TemplateBinding Padding}" Style="{StaticResource ScrollViewerClearStyle}" c1:ClearStyleExtensions.ScrollBarStyle="{Binding Path=ScrollBarStyle,RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" c1:ClearStyleExtensions.ButtonBackground="{StaticResource BaseColorBrush}" c1:ClearStyleExtensions.ButtonForeground="{TemplateBinding Foreground}" Foreground="Blue">
                                <ItemsPresenter />
                                <c1:ScrollViewerTouchBehavior.TouchBehavior>
                                    <c1:ScrollViewerTouchBehavior />
                                </c1:ScrollViewerTouchBehavior.TouchBehavior>
                            </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" Width="15" StrokeThickness="{TemplateBinding StrokeThickness}" Y2="{TemplateBinding Height}" X1="6.5" Y1="0" X2="6.5"
                          Stroke="{TemplateBinding Stroke}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

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

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

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

    <ControlTemplate x:Key="LastItemLineTemplate" TargetType="c1:C1TreeViewLine">
        <Path x:Name="Line" Width="15" Height="20" Data="M 6.5,0 L 6.5,10.5 L 15,10.5" Stroke="{TemplateBinding Stroke}" StrokeThickness="{TemplateBinding StrokeThickness}"/>
    </ControlTemplate>
    
    <!-- C1TreeViewItem -->
	<Style TargetType="c1:C1TreeViewItem">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="Transparent" />
		<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>
										<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="0" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)">
											<DiscreteObjectKeyFrame KeyTime="00:00:00">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Collapsed</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 connections-->
                            <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 ExclusiveItemLineTemplate}"/>
                                        </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 RootItemLineTemplate}"/>
                                        </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 LastItemLineTemplate}"/>
                                        </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="Background" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource TreeViewItemCornerRadius}" />
                        <c1:C1BrushBuilder x:Name="SelectedBackground" Input="{TemplateBinding SelectedBackground}" DesignBrush="{StaticResource TreeViewItemSelectedBackground}" DesignColor="{StaticResource SelectedColor}" />
                        <c1:C1BrushBuilder x:Name="MouseOverBrush" Input="{TemplateBinding MouseOverBrush}" DesignBrush="{StaticResource TreeViewItemMouseOverBrush}" DesignColor="{StaticResource MouseOverColor}" />
                        <Border x:Name="SelectedElement" Background="{Binding Output, ElementName=SelectedBackground}" BorderBrush="{TemplateBinding SelectedBackground}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource TreeViewItemCornerRadius}" Visibility="Collapsed" />
                        <Border x:Name="MouseOverElement" Background="{Binding Output, ElementName=MouseOverBrush}" BorderBrush="{TemplateBinding MouseOverBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource TreeViewItemCornerRadius}" Visibility="Collapsed" />
                        <Grid x:Name="HeaderPanel" MinHeight="20" Background="Transparent" Margin="2 0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="11" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <c1:C1TreeViewLine Margin="-2,0,0,0" x:Name="ItemLine" Visibility="Collapsed"
                                               Width="15" Height="20" 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}"/>
                            <Border x:Name="DisabledVisualElement" Background="{StaticResource DisabledBrush}" 
                                    CornerRadius="{StaticResource GeneralCornerRadius}" IsHitTestVisible="False" Visibility="Collapsed" />
                        </Grid>

                        <Grid Grid.Row="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="15" />
                                <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>