<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:grid="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView" xmlns:input="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" xmlns:treelist="clr-namespace:Telerik.Windows.Controls.TreeListView;assembly=Telerik.Windows.Controls.GridView" xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView">
  <telerik:MetroColors x:Key="MetroColors" />
  <SolidColorBrush x:Key="StrongBrush" Color="{Binding Path=Palette.StrongColor, Source={StaticResource MetroColors}}" telerik:MetroColors.Color="BoundColor" />
  <SolidColorBrush x:Key="MainBrush" Color="{Binding Path=Palette.MainColor, Source={StaticResource MetroColors}}" telerik:MetroColors.Color="BoundColor" />
  <SolidColorBrush x:Key="AccentBrush" Color="{Binding Path=Palette.AccentColor, Source={StaticResource MetroColors}}" telerik:MetroColors.Color="BoundColor" />
  <SolidColorBrush x:Key="BasicBrush" Color="{Binding Path=Palette.BasicColor, Source={StaticResource MetroColors}}" telerik:MetroColors.Color="BoundColor" />
  <grid:FilterOperatorConverter x:Key="FilterOperatorConverter" />
  <grid:FilterCompositionLogicalOperatorConverter x:Key="FilterCompositionLogicalOperatorConverter" />
  <grid:DistinctValueConverter x:Key="DistinctValueConverter" />
  <grid:FilterOperatorToFilterEditorIsEnabledConverter x:Key="FilterOperatorToFilterEditorIsEnabledConverter" />
  <SolidColorBrush x:Key="MarkerBrush" Color="{Binding Path=Palette.MarkerColor, Source={StaticResource MetroColors}}" telerik:MetroColors.Color="BoundColor" />
  <SolidColorBrush x:Key="ValidationBrush" Color="{Binding Path=Palette.ValidationColor, Source={StaticResource MetroColors}}" telerik:MetroColors.Color="BoundColor" />
  <grid:GridLineWidthToThicknessConverter x:Key="GridLineWidthToThicknessConverter" />
  <telerik:BooleanToOpacityConverter x:Key="BooleanToOpacityConverter" />
  <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
  <!--AggregateResultsList-->
  <Style x:Key="AggregateResultsListStyle" TargetType="grid:AggregateResultsList">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <ItemsPresenter />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemTemplate">
      <Setter.Value>
        <DataTemplate>
          <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding Caption}" />
            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding FormattedValue}" />
          </StackPanel>
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <StackPanel Orientation="Vertical" />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:AggregateResultsList" BasedOn="{StaticResource AggregateResultsListStyle}" />
  <!--ChildDataControlsPresenter-->
  <ControlTemplate x:Key="ChildDataControlsPresenterTemplate" TargetType="grid:ChildDataControlsPresenter">
    <ItemsControl x:Name="PART_ChildDataItemsControl" ItemsSource="{Binding}" IsTabStop="{TemplateBinding IsTabStop}">
      <ItemsControl.ItemTemplate>
        <DataTemplate>
          <grid:GridViewDataControl IsTabStop="{Binding IsTabStop, ElementName=PART_ChildDataItemsControl}" />
        </DataTemplate>
      </ItemsControl.ItemTemplate>
    </ItemsControl>
  </ControlTemplate>
  <Style x:Key="ChildDataControlsPresenterStyle" TargetType="grid:ChildDataControlsPresenter">
    <Setter Property="Template" Value="{StaticResource ChildDataControlsPresenterTemplate}" />
  </Style>
  <Style TargetType="grid:ChildDataControlsPresenter" BasedOn="{StaticResource ChildDataControlsPresenterStyle}" />
  <!--CommonColumnHeader-->
  <ControlTemplate x:Key="CommonColumnHeaderTemplate" TargetType="grid:CommonColumnHeader">
    <Grid x:Name="PART_HeaderCellGrid">
      <Border x:Name="GridViewHeaderCell" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
      <ContentPresenter x:Name="ContentPresenter" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="CommonColumnHeaderStyle" TargetType="grid:CommonColumnHeader">
    <Setter Property="Template" Value="{StaticResource CommonColumnHeaderTemplate}" />
    <Setter Property="Foreground" Value="{StaticResource StrongBrush}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
    <Setter Property="BorderThickness" Value="0,0,1,1" />
    <Setter Property="MinHeight" Value="30" />
    <Setter Property="Padding" Value="5,0,3,0" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:CommonColumnHeader" BasedOn="{StaticResource CommonColumnHeaderStyle}" />
  <!--CommonHeaderPresenter-->
  <ControlTemplate x:Key="CommonHeaderPresenterTemplate" TargetType="grid:CommonHeaderPresenter">
    <Border Visibility="{TemplateBinding Visibility}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="Stretch">
      <Grid x:Name="PART_CommonHeadersContainer" Margin="0,0,0,-1" HorizontalAlignment="Left" />
    </Border>
  </ControlTemplate>
  <Style x:Key="CommonHeaderPresenterStyle" TargetType="grid:CommonHeaderPresenter">
    <Setter Property="Template" Value="{StaticResource CommonHeaderPresenterTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
    <Setter Property="BorderThickness" Value="0,0,0,1" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:CommonHeaderPresenter" BasedOn="{StaticResource CommonHeaderPresenterStyle}" />
  <!--DataCellsPresenter-->
  <ControlTemplate x:Key="DataCellsPresenterTemplate" TargetType="grid:DataCellsPresenter">
    <Grid>
      <ItemsPresenter />
      <grid:FrozenColumnsSplitter HorizontalAlignment="Left" x:Name="PART_FrozenColumnsSplitter" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="DataCellsPresenterStyle" TargetType="grid:DataCellsPresenter">
    <Setter Property="Template" Value="{StaticResource DataCellsPresenterTemplate}" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <grid:GridViewCellsPanel />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:DataCellsPresenter" BasedOn="{StaticResource DataCellsPresenterStyle}" />
  <!--DetailsPresenter-->
  <ControlTemplate x:Key="DetailsPresenterTemplate" TargetType="grid:DetailsPresenter">
    <Border x:Name="DetailsBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="DetailsStates">
          <VisualState x:Name="DetailsVisible">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="DetailsBorder" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="DetailsCollapsed" />
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <ContentPresenter x:Name="PART_ContentPresenter" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
    </Border>
  </ControlTemplate>
  <Style x:Key="DetailsPresenterStyle" TargetType="grid:DetailsPresenter">
    <Setter Property="Template" Value="{StaticResource DetailsPresenterTemplate}" />
    <Setter Property="Visibility" Value="Collapsed" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="1,1,0,1" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:DetailsPresenter" BasedOn="{StaticResource DetailsPresenterStyle}" />
  <!--DistinctFilterControl-->
  <ControlTemplate TargetType="grid:FilteringDropDown" x:Key="DistinctFilterControlTemplate">
    <Grid>
      <Button x:Name="PART_DropDownButton">
        <Button.Template>
          <ControlTemplate TargetType="Button">
            <ContentPresenter />
          </ControlTemplate>
        </Button.Template>
        <Border Cursor="Hand" Width="22" Height="22" Background="Transparent">
          <Grid Width="12" Height="13">
            <Path Data="M0.93340254,0 L4.934082,0 L6.934082,0 L10.93358,0 C11.996876,0 12.199773,0.75 11.668063,1.359375 L8.4335356,5.5 C8.100522,5.8975558 7.983531,6.062263 7.9429321,6.2736206 L7.934082,6.3298788 L7.934082,10.332101 C7.934082,10.332101 3.9340818,14.997499 3.9340818,14.997499 L3.9340818,6.3293748 L3.9286206,6.3012671 C3.8825667,6.1045012 3.751812,5.9296875 3.3865709,5.5 L0.24589038,1.40625 C-0.2067349,0.84375 -0.066181421,1.2241071E-16 0.93340254,0 z" Fill="{StaticResource StrongBrush}" Stretch="Fill" Margin="2,1,2,2" Width="8" Height="11" />
            <Path Data="M0.93340254,0 L4.934082,0 L6.934082,0 L10.93358,0 C11.996876,0 12.199773,0.75 11.668063,1.359375 L8.4335356,5.5 C8.100522,5.8975558 7.983531,6.062263 7.9429321,6.2736206 L7.934082,6.3298788 L7.934082,10.332101 C7.934082,10.332101 3.9340818,14.997499 3.9340818,14.997499 L3.9340818,6.3293748 L3.9286206,6.3012671 C3.8825667,6.1045012 3.751812,5.9296875 3.3865709,5.5 L0.24589038,1.40625 C-0.2067349,0.84375 -0.066181421,1.2241071E-16 0.93340254,0 z" Fill="{StaticResource AccentBrush}" Width="8" Height="11" Visibility="{TemplateBinding FunnelFillVisibility}" Margin="2,1,2,2" Stretch="Fill" />
          </Grid>
        </Border>
      </Button>
      <Popup x:Name="PART_DropDownPopup">
        <Popup.StaysOpen>True</Popup.StaysOpen>
        <Popup.AllowsTransparency>True</Popup.AllowsTransparency>
        <Popup.PopupAnimation>Slide</Popup.PopupAnimation>
      </Popup>
    </Grid>
  </ControlTemplate>
  <Style x:Key="FilteringDropDownStyle" TargetType="grid:FilteringDropDown">
    <Setter Property="Template" Value="{StaticResource DistinctFilterControlTemplate}" />
  </Style>
  <Style TargetType="grid:FilteringDropDown" BasedOn="{StaticResource FilteringDropDownStyle}" />
  <!--FilterControl-->
  <DataTemplate x:Key="ActionTemplate">
    <TextBlock Text="{Binding Converter={StaticResource FilterOperatorConverter}}" />
  </DataTemplate>
  <DataTemplate x:Key="LogicalOperatorTemplate">
    <TextBlock Text="{Binding Converter={StaticResource FilterCompositionLogicalOperatorConverter}}" />
  </DataTemplate>
  <ControlTemplate x:Key="FilteringControlTemplate" TargetType="grid:FilteringControl">
    <Border BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}" CornerRadius="1" BorderBrush="{TemplateBinding BorderBrush}">
      <Grid>
        <StackPanel MinWidth="200" MaxWidth="350" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
          <StackPanel x:Name="PART_DistinctFilter" Visibility="{TemplateBinding DistinctFiltersVisibility}">
            <CheckBox x:Name="PART_SelectAllCheckBox" IsChecked="{Binding SelectAll, Mode=TwoWay}" Margin="0,2" telerik:LocalizationManager.ResourceKey="GridViewFilterSelectAll" />
            <ListBox x:Name="PART_DistinctValuesList" ItemsSource="{Binding DistinctValues}" ScrollViewer.HorizontalScrollBarVisibility="Auto" SelectionMode="Multiple">
              <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                  <VirtualizingStackPanel MaxHeight="242" />
                </ItemsPanelTemplate>
              </ListBox.ItemsPanel>
              <ListBox.ItemTemplate>
                <DataTemplate>
                  <CheckBox IsChecked="{Binding IsActive, Mode=TwoWay}" Content="{Binding ConvertedValue, Converter={StaticResource DistinctValueConverter}}" VerticalContentAlignment="Center" />
                </DataTemplate>
              </ListBox.ItemTemplate>
            </ListBox>
          </StackPanel>
          <StackPanel Margin="0,2" Visibility="{TemplateBinding FieldFiltersVisibility}">
            <TextBlock telerik:LocalizationManager.ResourceKey="GridViewFilterShowRowsWithValueThat" Margin="0,2,0,0" />
            <input:RadComboBox x:Name="PART_Filter1ComboBox" Margin="0,2,0,2" ItemTemplate="{StaticResource ActionTemplate}" ItemsSource="{Binding AvailableActions}" SelectedItem="{Binding Filter1.Operator, Mode=TwoWay}" />
            <ContentControl x:Name="PART_Filter1ContentControl" DataContext="{Binding Filter1}" Margin="0, 2" IsEnabled="{Binding Operator, Converter={StaticResource FilterOperatorToFilterEditorIsEnabledConverter}}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
            <input:RadComboBox x:Name="PART_LogicalOperatorsComboBox" Margin="0,2" ItemTemplate="{StaticResource LogicalOperatorTemplate}" ItemsSource="{Binding LogicalOperators}" SelectedItem="{Binding FieldFilterLogicalOperator, Mode=TwoWay}" />
            <input:RadComboBox x:Name="PART_Filter2ComboBox" Margin="0,2" ItemTemplate="{StaticResource ActionTemplate}" ItemsSource="{Binding AvailableActions}" SelectedItem="{Binding Filter2.Operator, Mode=TwoWay}" />
            <ContentControl x:Name="PART_Filter2ContentControl" DataContext="{Binding Filter2}" Margin="0, 2" IsEnabled="{Binding Operator, Converter={StaticResource FilterOperatorToFilterEditorIsEnabledConverter}}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
          </StackPanel>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition />
              <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Button x:Name="PART_ApplyFilterButton" Grid.Column="0" Margin="0,2,2,2" Height="22" Visibility="{TemplateBinding FilterButtonVisibility}" telerik:LocalizationManager.ResourceKey="GridViewFilter" />
            <Button x:Name="PART_ClearFilterButton" Grid.Column="1" Margin="2,2,0,2" Height="22" telerik:LocalizationManager.ResourceKey="GridViewClearFilter" />
          </Grid>
        </StackPanel>
        <telerik:RadButton x:Name="PART_FilterCloseButton" Grid.Column="1" Margin="{TemplateBinding Padding}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="13" Height="13">
          <Path Fill="{StaticResource StrongBrush}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="6" Height="6" Data="M4,4L5,4 5,5 4,5z M0,4L1,4 1,5 0,5z M3,3L4,3 4,4 3,4z M1,3L2,3 2,4 1,4z M2,2L3,2 3,3 2,3z M4,0L5,0 5,1 4,1 4,2 3,2 3,0.99999994 4,0.99999994z M0,0L1,0 1,0.99999994 2,0.99999994 2,2 1,2 1,1 0,1z" />
        </telerik:RadButton>
      </Grid>
    </Border>
  </ControlTemplate>
  <Style x:Key="FilteringControlStyle" TargetType="grid:FilteringControl">
    <Setter Property="Template" Value="{StaticResource FilteringControlTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="Padding" Value="5" />
    <Setter Property="Margin" Value="0,2,0,0" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Foreground" Value="{StaticResource MarkerBrush}" />
    <Setter Property="FontWeight" Value="Normal" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:FilteringControl" BasedOn="{StaticResource FilteringControlStyle}" />
  <!--DraggedElement-->
  <!--FrozenColumnsSplitter-->
  <ControlTemplate x:Key="FrozenColumnsSplitterTemplate" TargetType="grid:FrozenColumnsSplitter">
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Width="5">
      <Border Background="{TemplateBinding Background}" Opacity="0.2" Width="4" />
    </Border>
  </ControlTemplate>
  <Style x:Key="FrozenColumnsSplitterStyle" TargetType="grid:FrozenColumnsSplitter">
    <Setter Property="Template" Value="{StaticResource FrozenColumnsSplitterTemplate}" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="BorderThickness" Value="1,0,0,0" />
    <Setter Property="BorderBrush" Value="{StaticResource StrongBrush}" />
    <Setter Property="Background" Value="{StaticResource StrongBrush}" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:FrozenColumnsSplitter" BasedOn="{StaticResource FrozenColumnsSplitterStyle}" />
  <!--GridViewAggregateResultCell-->
  <ControlTemplate x:Key="GridViewAggregateResultCellTemplate" TargetType="grid:GridViewAggregateResultCell">
    <StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
      <TextBlock Margin="10,0,0,0" TextAlignment="Right" VerticalAlignment="Center" Text="{Binding Caption}" />
      <TextBlock Margin="3,0" TextAlignment="Right" VerticalAlignment="Center" Text="{Binding FormattedValue}" />
    </StackPanel>
  </ControlTemplate>
  <Style x:Key="GridViewAggregateResultCellStyle" TargetType="grid:GridViewAggregateResultCell">
    <Setter Property="Template" Value="{StaticResource GridViewAggregateResultCellTemplate}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="Foreground" Value="{StaticResource AccentBrush}" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewAggregateResultCell" BasedOn="{StaticResource GridViewAggregateResultCellStyle}" />
  <!--GridViewCell-->
  <Style x:Key="FocusVisualStyle">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle StrokeThickness="1" Stroke="{StaticResource MarkerBrush}" Margin="0,0,0,1" Opacity="0.2" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="GridViewCell_ValidationToolTipTemplate" TargetType="ToolTip">
    <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="OpenStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="0" />
            <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
              <Storyboard>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
                </DoubleAnimationUsingKeyFrames>
              </Storyboard>
            </VisualTransition>
          </VisualStateGroup.Transitions>
          <VisualState x:Name="Closed">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Open">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid.RenderTransform>
        <TranslateTransform x:Name="xform" X="-25" />
      </Grid.RenderTransform>
      <Border Background="{StaticResource ValidationBrush}">
        <ItemsControl ItemsSource="{TemplateBinding Content}">
          <ItemsControl.ItemTemplate>
            <DataTemplate>
              <TextBlock Margin="8,4,8,4" MaxWidth="250" Foreground="{StaticResource MainBrush}" Text="{Binding}" TextWrapping="Wrap" />
            </DataTemplate>
          </ItemsControl.ItemTemplate>
          <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
              <StackPanel />
            </ItemsPanelTemplate>
          </ItemsControl.ItemsPanel>
        </ItemsControl>
      </Border>
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="GridViewCellTemplate" TargetType="grid:GridViewCell">
    <Grid>
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="SelectionStates">
          <VisualState x:Name="Unselected" />
          <VisualState x:Name="Selected">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Selected" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
          <VisualState x:Name="Current">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Current" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="MouseOver">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Over" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="EditingStates">
          <VisualState x:Name="Edited">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Margin">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Thickness>0</Thickness>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="VerticalAlignment">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <VerticalAlignment>Stretch</VerticalAlignment>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_CellBorder" Storyboard.TargetProperty="Background">
                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource MainBrush}" />
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Display" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="DisabledStates">
          <VisualState x:Name="Enabled" />
          <VisualState x:Name="Disabled">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.3" />
              </DoubleAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Disabled" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ValueStates">
          <VisualState x:Name="CellValid" />
          <VisualState x:Name="CellInvalid">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Invalid" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="InvalidUnfocused">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Invalid_Unfocused" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Border x:Name="PART_CellBorder" Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding VerticalGridLinesBrush}" BorderThickness="{Binding VerticalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Right}" />
      <Border x:Name="Background_Over" Background="{StaticResource StrongBrush}" Opacity="0.2" BorderBrush="{TemplateBinding VerticalGridLinesBrush}" BorderThickness="{Binding VerticalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Right}" Grid.Column="2" Grid.ColumnSpan="2" Visibility="Collapsed" />
      <Border x:Name="Background_Selected" Background="{StaticResource BasicBrush}" BorderBrush="{TemplateBinding VerticalGridLinesBrush}" Margin="0,0,0,1" BorderThickness="{Binding VerticalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Right}" Grid.Column="2" Grid.ColumnSpan="2" Visibility="Collapsed" />
      <Border x:Name="Background_Current" BorderThickness="1" Margin="0,0,0,1" BorderBrush="{StaticResource MarkerBrush}" Opacity="0.2" Grid.Column="2" Grid.ColumnSpan="2" Visibility="Collapsed" />
      <Border x:Name="Background_Invalid_Unfocused" Visibility="Collapsed" BorderThickness="1" BorderBrush="{StaticResource ValidationBrush}" Grid.Column="2" Grid.ColumnSpan="2" Opacity="1" />
      <Border x:Name="Background_Invalid" Background="{StaticResource MainBrush}" Margin="1,1,2,2" BorderThickness="1" BorderBrush="{StaticResource ValidationBrush}" Grid.Column="2" Grid.ColumnSpan="2" Visibility="Collapsed">
        <ToolTipService.ToolTip>
          <ToolTip x:Name="validationTooltip" Placement="Right" Content="{TemplateBinding Errors}" Template="{StaticResource GridViewCell_ValidationToolTipTemplate}"></ToolTip>
        </ToolTipService.ToolTip>
        <Grid HorizontalAlignment="Right" Height="6" VerticalAlignment="Top" Width="6">
          <Path Fill="{StaticResource ValidationBrush}" Width="4" Height="4" Margin="1" Data="M0,0 L4,0 L4,4 z" />
        </Grid>
      </Border>
      <Border x:Name="Background_Disabled" Background="{StaticResource MainBrush}" Opacity="0.5" Grid.Column="2" Grid.ColumnSpan="2" Visibility="Collapsed" />
      <ContentPresenter x:Name="PART_ContentPresenter" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="GridViewCellStyle" TargetType="grid:GridViewCell">
    <Setter Property="Template" Value="{StaticResource GridViewCellTemplate}" />
    <Setter Property="Padding" Value="5,0,3,0" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="0,0,1,0" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
  </Style>
  <Style TargetType="grid:GridViewCell" BasedOn="{StaticResource GridViewCellStyle}" />
  <!--GridViewHeaderCell-->
  <Pen x:Key="GridViewHeaderCellDropMarkerPen" Brush="{StaticResource MainBrush}" Thickness="2" />
  <Style x:Key="ColumnHeaderGripperStyle" TargetType="Thumb">
    <Setter Property="Width" Value="6" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="Cursor" Value="SizeWE" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Thumb">
          <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="ContentControl" x:Key="StretchedContentControl">
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
  </Style>
  <ControlTemplate x:Key="GridViewHeaderCellTemplate" TargetType="grid:GridViewHeaderCell">
    <Grid x:Name="PART_HeaderCellGrid">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
          <VisualState x:Name="MouseOver">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GridViewHeaderCell_Over" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Ascending">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource StrongBrush}" />
              </ObjectAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GridViewHeaderCell_Selected" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Descending">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="PART_SortIndicator">
                <EasingDoubleKeyFrame KeyTime="0:0:0" Value="180" />
              </DoubleAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GridViewHeaderCell_Selected" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Border x:Name="GridViewHeaderCell" Grid.ColumnSpan="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
      <Border x:Name="GridViewHeaderCell_Over" Opacity="0.1" Grid.ColumnSpan="2" Background="{StaticResource StrongBrush}" BorderBrush="Transparent" Visibility="Collapsed" />
      <Border x:Name="GridViewHeaderCell_Selected" Grid.ColumnSpan="2" Margin="0,0,1,1" Background="{StaticResource BasicBrush}" BorderBrush="Transparent" Visibility="Collapsed" />
      <ContentControl x:Name="ContentPresenter" Grid.Column="0" Foreground="{TemplateBinding Foreground}" Style="{StaticResource StretchedContentControl}" Margin="{TemplateBinding Padding}" IsTabStop="{TemplateBinding IsTabStop}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
      <Path x:Name="PART_SortIndicator" Data="M10.000001,0 L20.000002,20 L2.3395899E-08,20 z" Fill="{StaticResource StrongBrush}" RenderTransformOrigin="0.5,0.5" Opacity="0" HorizontalAlignment="Center" Margin="0,2,0,0" VerticalAlignment="Top" Stretch="Fill" Width="4" Height="4">
        <Path.RenderTransform>
          <TransformGroup>
            <ScaleTransform />
            <SkewTransform />
            <RotateTransform />
            <TranslateTransform />
          </TransformGroup>
        </Path.RenderTransform>
      </Path>
      <grid:FilteringDropDown Name="PART_DistinctFilterControl" Grid.Column="1" Visibility="{TemplateBinding FilteringUIVisibility}" Margin="0,0,-2,0" />
      <Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" IsTabStop="{TemplateBinding IsTabStop}" Style="{StaticResource ColumnHeaderGripperStyle}" Grid.ColumnSpan="2" />
      <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" IsTabStop="{TemplateBinding IsTabStop}" Style="{StaticResource ColumnHeaderGripperStyle}" Grid.ColumnSpan="2" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="GridViewHeaderCellStyle" TargetType="grid:GridViewHeaderCell">
    <Setter Property="Template" Value="{StaticResource GridViewHeaderCellTemplate}" />
    <Setter Property="Foreground" Value="{StaticResource StrongBrush}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
    <Setter Property="BorderThickness" Value="0,0,1,1" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="5,0,3,0" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="DropMarkPen" Value="{StaticResource MainBrush}" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewHeaderCell" BasedOn="{StaticResource GridViewHeaderCellStyle}" />
  <!--GridViewFooterCell-->
  <ControlTemplate x:Key="GridViewFooterCellTemplate" TargetType="grid:GridViewFooterCell">
    <Border x:Name="PART_FooterCellBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewFooterCellStyle" TargetType="grid:GridViewFooterCell">
    <Setter Property="Template" Value="{StaticResource GridViewFooterCellTemplate}" />
    <Setter Property="BorderThickness" Value="0,0,0,0" />
    <Setter Property="Padding" Value="5,0,3,0" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Foreground" Value="{StaticResource StrongBrush}" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewFooterCell" BasedOn="{StaticResource GridViewFooterCellStyle}" />
  <!--GridViewGroupFooterCell-->
  <ControlTemplate x:Key="GridViewGroupFooterCellTemplate" TargetType="grid:GridViewGroupFooterCell">
    <Border x:Name="PART_FooterCellBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewGroupFooterCellStyle" TargetType="grid:GridViewGroupFooterCell">
    <Setter Property="Template" Value="{StaticResource GridViewGroupFooterCellTemplate}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="0,0,0,0" />
    <Setter Property="Padding" Value="5,0,3,0" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="Foreground" Value="{StaticResource StrongBrush}" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewGroupFooterCell" BasedOn="{StaticResource GridViewGroupFooterCellStyle}" />
  <!--GridViewIndentCell-->
  <Style x:Key="GridViewIndentCellStyle" TargetType="grid:GridViewIndentCell">
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="0,0,1,0" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="grid:GridViewIndentCell">
          <Border BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" BorderThickness="{TemplateBinding BorderThickness}" Width="25" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="grid:GridViewIndentCell" BasedOn="{StaticResource GridViewIndentCellStyle}" />
  <!--GridViewFooterIndentCell-->
  <Style x:Key="GridViewFooterIndentCellStyle" TargetType="grid:GridViewFooterIndentCell">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="grid:GridViewFooterIndentCell">
          <Border BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Width="25"></Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="BorderBrush" Value="{x:Null}" />
    <Setter Property="BorderThickness" Value="0,0,0,0" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  </Style>
  <Style TargetType="grid:GridViewFooterIndentCell" BasedOn="{StaticResource GridViewFooterIndentCellStyle}" />
  <!--GridViewGroupFooterIndentCell-->
  <Style x:Key="GridViewGroupFooterIndentCellStyle" TargetType="grid:GridViewGroupFooterIndentCell">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="grid:GridViewGroupFooterIndentCell">
          <Border BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Width="25"></Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="0,0,1,0" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  </Style>
  <Style TargetType="grid:GridViewGroupFooterIndentCell" BasedOn="{StaticResource GridViewGroupFooterIndentCellStyle}" />
  <!--GridViewHeaderIndentCell-->
  <Style x:Key="GridViewHeaderIndentCellStyle" TargetType="grid:GridViewHeaderIndentCell">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="grid:GridViewHeaderIndentCell">
          <Border x:Name="OuterBorder" Width="25" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="BorderThickness" Value="0,0,1,1" />
    <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewHeaderIndentCell" BasedOn="{StaticResource GridViewHeaderIndentCellStyle}" />
  <!--GridViewRow-->
  <ControlTemplate x:Key="GridViewRow_ValidationToolTipTemplate" TargetType="ToolTip">
    <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="OpenStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="0" />
            <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
              <Storyboard>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
                </DoubleAnimationUsingKeyFrames>
              </Storyboard>
            </VisualTransition>
          </VisualStateGroup.Transitions>
          <VisualState x:Name="Closed">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Open">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid.RenderTransform>
        <TranslateTransform x:Name="xform" X="-25" />
      </Grid.RenderTransform>
      <Border Margin="4,4,-4,-4" Background="#052A2E31" CornerRadius="5" />
      <Border Margin="3,3,-3,-3" Background="#152A2E31" CornerRadius="4" />
      <Border Margin="2,2,-2,-2" Background="#252A2E31" CornerRadius="3" />
      <Border Margin="1,1,-1,-1" Background="#352A2E31" CornerRadius="2" />
      <Border Background="#FFDC000C" CornerRadius="2" />
      <Border CornerRadius="2">
        <ItemsControl ItemsSource="{TemplateBinding Content}">
          <ItemsControl.ItemTemplate>
            <DataTemplate>
              <TextBlock Margin="8,4,8,4" MaxWidth="250" Foreground="White" Text="{Binding}" TextWrapping="Wrap" />
            </DataTemplate>
          </ItemsControl.ItemTemplate>
          <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
              <StackPanel />
            </ItemsPanelTemplate>
          </ItemsControl.ItemsPanel>
        </ItemsControl>
      </Border>
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="GridViewRowTemplate" TargetType="grid:GridViewRow">
    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="FocusStates">
          <VisualState x:Name="Unfocused" />
          <VisualState x:Name="Focused">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NavigatorIndicator" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="SelectionStates">
          <VisualState x:Name="Unselected" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
          <VisualState x:Name="MouseOver">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="Background_Over" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Selected">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="Background_Selected" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ValueStates">
          <VisualState x:Name="RowValid" />
          <VisualState x:Name="RowInvalid">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Invalid" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ErrorIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="EditStates">
          <VisualState x:Name="ReadOnlyMode" />
          <VisualState x:Name="EditMode">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <grid:SelectiveScrollingGrid x:Name="grid">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="*" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Border x:Name="SelectionBackground" Grid.Column="2" Grid.ColumnSpan="2" Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Padding="{TemplateBinding Padding}" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" />
        <Border x:Name="PART_RowBorder" BorderBrush="{TemplateBinding HorizontalGridLinesBrush}" BorderThickness="{Binding HorizontalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Bottom}" Grid.ColumnSpan="4" Grid.Column="1" Grid.RowSpan="4" VerticalAlignment="Bottom" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" />
        <Rectangle x:Name="Background_Over" Fill="{StaticResource StrongBrush}" Opacity="0.1" Grid.Column="0" Grid.ColumnSpan="4" Visibility="Collapsed" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" />
        <Rectangle x:Name="Background_Selected" Fill="{StaticResource BasicBrush}" Margin="0,0,0,1" Grid.Column="0" Grid.ColumnSpan="4" Visibility="Collapsed" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" />
        <Rectangle x:Name="Background_Invalid" Stroke="{StaticResource ValidationBrush}" Fill="{StaticResource MainBrush}" StrokeThickness="1" Grid.Column="0" Grid.ColumnSpan="4" Visibility="Collapsed" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" />
        <controls:GridViewToggleButton Grid.Column="2" x:Name="PART_HierarchyExpandButton" Width="25" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Opacity="{Binding IsExpandable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToOpacityConverter}}" IsHitTestVisible="{Binding IsExpandable, RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding HasHierarchy, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsTabStop="{TemplateBinding IsTabStop}" />
        <Border Grid.Column="2" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HasHierarchy, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" />
        <grid:DataCellsPresenter Grid.Column="3" x:Name="PART_DataCellsPresenter" />
        <Border Grid.Column="2" Grid.Row="2" Grid.ColumnSpan="2" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True">
          <ContentPresenter x:Name="PART_HierarchyChildPresenter" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" Margin="0,1,0,0" Visibility="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" />
        </Border>
        <grid:DetailsPresenter x:Name="PART_DetailsPresenter" Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="1" DetailsProvider="{TemplateBinding DetailsProvider}" />
        <Border x:Name="PART_IndicatorPresenter" Width="25" VerticalAlignment="Stretch" Grid.Column="0" Visibility="{TemplateBinding RowIndicatorVisibility}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Grid.RowSpan="3" Background="Transparent">
          <Grid>
            <Grid x:Name="NavigatorIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="9" Height="9" Visibility="Collapsed">
              <Path x:Name="plus" Stretch="Fill" Width="8" Height="4" Data="M0,0 L8,2.3841858E-07 L4,4 z" RenderTransformOrigin="0.5,0.5" Fill="{StaticResource AccentBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}">
                <Path.RenderTransform>
                  <TransformGroup>
                    <ScaleTransform ScaleY="-1" />
                    <SkewTransform />
                    <RotateTransform Angle="90" />
                    <TranslateTransform X="9.5006054579016563E-08" Y="-4.6599587300022449E-08" />
                  </TransformGroup>
                </Path.RenderTransform>
              </Path>
            </Grid>
            <Border x:Name="EditIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="12" Height="10" Visibility="Collapsed" Background="{StaticResource MainBrush}" BorderBrush="{StaticResource StrongBrush}" BorderThickness="1">
              <Path Fill="{StaticResource StrongBrush}" Stretch="Fill" Data="M3,2 L4,2 L5,2 L6,2 L6,3 L5,3 L5,4 L5,5 L5,6 L5,7 L6,7 L6,8 L5,8 L4,8 L3,8 L3,7 L4,7 L4,6 L4,5 L4,4 L4,3 L3,3 z" HorizontalAlignment="Left" Margin="1,1,0,1" Width="3" Height="6" />
            </Border>
            <Grid x:Name="ErrorIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed">
              <Ellipse Fill="{StaticResource MainBrush}" Width="16" Height="16" Stroke="{StaticResource ValidationBrush}" />
              <Path Data="M1.0000001,8 C1.5522848,8 2.0000002,8.4477148 2.0000002,9 C2.0000002,9.5522842 1.5522848,10 1.0000001,10 C0.4477154,10 1.527369E-07,9.5522842 1.4901161E-07,9 C1.527369E-07,8.4477148 0.4477154,8 1.0000001,8 z M0,0 L2,0 L2,7 L0,7 z" Fill="{StaticResource ValidationBrush}" Width="2" Height="10" Stretch="Fill" />
              <ToolTipService.ToolTip>
                <ToolTip x:Name="validationTooltip" Placement="Bottom" Content="{TemplateBinding Errors}" Template="{StaticResource GridViewRow_ValidationToolTipTemplate}"></ToolTip>
              </ToolTipService.ToolTip>
            </Grid>
            <Border x:Name="PART_RowResizer" Background="Transparent" Height="4" VerticalAlignment="Bottom" Cursor="SizeNS" />
          </Grid>
        </Border>
        <grid:IndentPresenter x:Name="PART_IndentPresenter" IndentLevel="{TemplateBinding IndentLevel}" Grid.Column="1" Grid.RowSpan="4" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
      </grid:SelectiveScrollingGrid>
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewRowStyle" TargetType="grid:GridViewRow">
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template" Value="{StaticResource GridViewRowTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="FontWeight" Value="Normal" />
    <Setter Property="AllowDrop" Value="True" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewRow" BasedOn="{StaticResource GridViewRowStyle}" />
  <!--GridViewNewRow-->
  <ControlTemplate x:Key="GridViewNewRow_ValidationToolTipTemplate" TargetType="ToolTip">
    <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="OpenStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="0" />
            <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
              <Storyboard>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
                </DoubleAnimationUsingKeyFrames>
              </Storyboard>
            </VisualTransition>
          </VisualStateGroup.Transitions>
          <VisualState x:Name="Closed">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Open">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid.RenderTransform>
        <TranslateTransform x:Name="xform" X="-25" />
      </Grid.RenderTransform>
      <Border Margin="4,4,-4,-4" Background="#052A2E31" CornerRadius="5" />
      <Border Margin="3,3,-3,-3" Background="#152A2E31" CornerRadius="4" />
      <Border Margin="2,2,-2,-2" Background="#252A2E31" CornerRadius="3" />
      <Border Margin="1,1,-1,-1" Background="#352A2E31" CornerRadius="2" />
      <Border Background="#FFDC000C" CornerRadius="2" />
      <Border CornerRadius="2">
        <ItemsControl ItemsSource="{TemplateBinding Content}">
          <ItemsControl.ItemTemplate>
            <DataTemplate>
              <TextBlock Margin="8,4,8,4" MaxWidth="250" Foreground="White" Text="{Binding}" TextWrapping="Wrap" />
            </DataTemplate>
          </ItemsControl.ItemTemplate>
          <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
              <StackPanel />
            </ItemsPanelTemplate>
          </ItemsControl.ItemsPanel>
        </ItemsControl>
      </Border>
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="GridViewNewRowTemplate" TargetType="grid:GridViewNewRow">
    <grid:SelectiveScrollingGrid x:Name="grid">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="FocusStates">
          <VisualState x:Name="Unfocused" />
          <VisualState x:Name="Focused" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="SelectionStates">
          <VisualState x:Name="Unselected" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
          <VisualState x:Name="MouseOver" />
          <VisualState x:Name="Selected" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="ValueStates">
          <VisualState x:Name="RowValid" />
          <VisualState x:Name="RowInvalid">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Invalid" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NewRowIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ErrorIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="EditStates">
          <VisualState x:Name="ReadOnlyMode">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_DataCellsPresenter" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_AlwaysVisibleNewRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="EditMode">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_DataCellsPresenter" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_AlwaysVisibleNewRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NewRowIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_RowBorder" Storyboard.TargetProperty="BorderBrush">
                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource BasicBrush}" />
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Border x:Name="SelectionBackground" Grid.Column="2" Grid.ColumnSpan="2" Background="{TemplateBinding Background}" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" Margin="{TemplateBinding Margin}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" />
      <Rectangle x:Name="Background_Invalid" Margin="0,0,0,1" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" Stroke="{StaticResource ValidationBrush}" StrokeThickness="1" Grid.Column="2" Grid.ColumnSpan="2" Visibility="Collapsed" />
      <Border Grid.Column="2" Width="25" BorderBrush="{TemplateBinding VerticalGridLinesBrush}" BorderThickness="{Binding VerticalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Right}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" Opacity="{Binding IsExpandable, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToOpacityConverter}}" IsHitTestVisible="{Binding IsExpandable, RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding HasHierarchy, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" />
      <grid:IndentPresenter x:Name="PART_IndentPresenter" BorderThickness="0,0,0,1" IndentLevel="{TemplateBinding IndentLevel}" Grid.Column="1" Grid.RowSpan="4" Background="Red" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
      <Border x:Name="PART_AlwaysVisibleNewRow" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" Margin="0" Background="{StaticResource BasicBrush}" Grid.Column="1" Grid.ColumnSpan="3">
        <TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Foreground="{StaticResource StrongBrush}" telerik:LocalizationManager.ResourceKey="GridViewAlwaysVisibleNewRow" />
      </Border>
      <grid:DataCellsPresenter Grid.Column="3" Visibility="Collapsed" x:Name="PART_DataCellsPresenter" />
      <Border x:Name="PART_RowBorder" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" BorderBrush="{StaticResource BasicBrush}" BorderThickness="0,0,0,1" Grid.ColumnSpan="4" Grid.Column="1" Grid.RowSpan="4" VerticalAlignment="Bottom" />
      <Border x:Name="PART_IndicatorPresenter" Width="25" VerticalAlignment="Stretch" Grid.Column="0" Margin="0,0,-1,0" Visibility="{TemplateBinding RowIndicatorVisibility}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Grid.RowSpan="3" Background="{StaticResource BasicBrush}">
        <Grid>
          <Grid x:Name="NewRowIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="11">
            <Path Data="M7.1791806,0 L11.037181,0 L11.037181,7.0529909 L17.976999,7.0529909 L17.976999,10.906991 L11.037181,10.906991 L11.037181,17.957001 L7.1791806,17.957001 L7.1791806,10.906991 L0,10.906991 L0,7.0529909 L7.1791806,7.0529909 z" Fill="{StaticResource StrongBrush}" Stretch="Fill" Width="9" Height="9" />
          </Grid>
          <Grid x:Name="EditIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="10" Visibility="Collapsed"></Grid>
          <Grid x:Name="ErrorIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Visibility="Collapsed">
            <ToolTipService.ToolTip>
              <ToolTip x:Name="validationTooltip" Placement="Bottom" Content="{TemplateBinding Errors}" Template="{StaticResource GridViewNewRow_ValidationToolTipTemplate}"></ToolTip>
            </ToolTipService.ToolTip>
          </Grid>
        </Grid>
      </Border>
    </grid:SelectiveScrollingGrid>
  </ControlTemplate>
  <Style x:Key="GridViewNewRowStyle" TargetType="grid:GridViewNewRow">
    <Setter Property="Template" Value="{StaticResource GridViewNewRowTemplate}" />
    <Setter Property="Background" Value="{StaticResource BasicBrush}" />
    <Setter Property="MinHeight" Value="25" />
    <Setter Property="FontFamily" Value="Segoe UI Semibold" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="Padding" Value="5,0,3,0" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewNewRow" BasedOn="{StaticResource GridViewNewRowStyle}" />
  <!--GridViewGroupRow-->
  <DataTemplate x:Key="GroupHeaderTemplate">
    <ContentControl Foreground="{StaticResource AccentBrush}" FontWeight="Bold" FontSize="12" Content="{Binding Header}" />
  </DataTemplate>
  <ControlTemplate x:Key="GridViewGroupToggleButtonTemplate" TargetType="ToggleButton">
    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <ContentPresenter />
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewGroupToggleButtonStyle" TargetType="ToggleButton">
    <Setter Property="Template" Value="{StaticResource GridViewGroupToggleButtonTemplate}" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Padding" Value="9,0,0,0" />
  </Style>
  <ControlTemplate x:Key="GridViewGroupRowTemplate" TargetType="grid:GridViewGroupRow">
    <Grid x:Name="PART_GroupExpanderGrid">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition x:Name="PART_HeaderRow" MinHeight="{TemplateBinding MinHeight}" />
        <RowDefinition x:Name="ContentRow" Height="Auto" />
      </Grid.RowDefinitions>
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="ExpandStateGroup">
          <VisualState x:Name="Expanded">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorder" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="IconOuterBorder" Storyboard.TargetProperty="BorderThickness">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Thickness>0</Thickness>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="ExpanderButton">
                <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Collapsed" />
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Border x:Name="ToggleButtonBorder" Background="{TemplateBinding Background}" Margin="-1,0,0,0" Grid.Column="2" Grid.ColumnSpan="2" MinHeight="{TemplateBinding MinHeight}" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="24" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
          </Grid.ColumnDefinitions>
          <!--Aggregates-->
          <Border grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" Visibility="{Binding ShowHeaderAggregates, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="2">
            <grid:AggregateResultsList ItemsSource="{TemplateBinding AggregateResults}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
              <grid:AggregateResultsList.ItemTemplate>
                <DataTemplate>
                  <grid:GridViewAggregateResultCell AggregateResult="{Binding}" />
                </DataTemplate>
              </grid:AggregateResultsList.ItemTemplate>
              <grid:AggregateResultsList.ItemsPanel>
                <ItemsPanelTemplate>
                  <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
              </grid:AggregateResultsList.ItemsPanel>
            </grid:AggregateResultsList>
          </Border>
          <!--Icon-->
          <Border x:Name="IconOuterBorder" BorderBrush="{StaticResource BasicBrush}" BorderThickness="0,0,0,1" Background="Transparent" HorizontalAlignment="Stretch" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
            <Path x:Name="ExpanderButton" Grid.Column="0" Fill="{StaticResource StrongBrush}" Width="6" Height="4" Stretch="Fill" Data="M10.000001,0 L20.000002,20 L2.3395899E-08,20 z" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="True">
              <Path.RenderTransform>
                <TransformGroup>
                  <ScaleTransform />
                  <SkewTransform />
                  <RotateTransform Angle="180" />
                  <TranslateTransform />
                </TransformGroup>
              </Path.RenderTransform>
            </Path>
          </Border>
          <!--ToggleButton-->
          <ToggleButton x:Name="HeaderButton" Grid.Column="0" Grid.ColumnSpan="3" Background="{TemplateBinding Background}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Opacity="0" IsTabStop="{TemplateBinding IsTabStop}" />
          <!--GroupHeader-->
          <ToggleButton Grid.Column="1" Padding="0,0,10,0" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Background="Transparent" BorderThickness="0" BorderBrush="{x:Null}" Style="{StaticResource GridViewGroupToggleButtonStyle}" Foreground="{TemplateBinding Foreground}" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" IsTabStop="{TemplateBinding IsTabStop}">
            <ContentPresenter Grid.Column="1" Margin="0,0,10,0" Content="{TemplateBinding GroupViewModel}" VerticalAlignment="Center" ContentTemplate="{TemplateBinding GroupHeaderTemplate}" />
          </ToggleButton>
          <Border grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" BorderBrush="{StaticResource BasicBrush}" BorderThickness="0,0,0,1" Grid.Column="1" Grid.ColumnSpan="2" />
        </Grid>
      </Border>
      <!--Indicator-->
      <Border x:Name="PART_IndicatorPresenter" Width="25" VerticalAlignment="Stretch" Grid.Column="0" Visibility="{TemplateBinding RowIndicatorVisibility}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Grid.RowSpan="3" Background="{StaticResource MainBrush}" BorderBrush="{StaticResource BasicBrush}" BorderThickness="0,0,1,0" />
      <!--Indent-->
      <grid:IndentPresenter grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" IndentLevel="{TemplateBinding Level}" Background="{TemplateBinding Background}" Grid.Column="1" />
      <!--Content-->
      <Border x:Name="Content" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" Visibility="Collapsed">
        <StackPanel>
          <grid:GridViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel" />
          <grid:GridViewGroupFooterRow x:Name="Footer" />
        </StackPanel>
      </Border>
      <Border x:Name="BottomBorder" Grid.Column="2" Grid.Row="1" BorderBrush="{StaticResource BasicBrush}" BorderThickness="0,0,0,1" VerticalAlignment="Bottom" Visibility="Collapsed" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="GridViewGroupRowStyle" TargetType="grid:GridViewGroupRow">
    <Setter Property="Template" Value="{StaticResource GridViewGroupRowTemplate}" />
    <Setter Property="GroupHeaderTemplate" Value="{StaticResource GroupHeaderTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="0,0,0,2" />
    <Setter Property="AllowDrop" Value="True" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="Padding" Value="10,0,0,0" />
    <Setter Property="MinHeight" Value="25" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewGroupRow" BasedOn="{StaticResource GridViewGroupRowStyle}" />
  <!--GridViewHeaderRow-->
  <DataTemplate x:Key="GridViewHeaderIndentCellDataTemplate">
    <grid:GridViewHeaderIndentCell />
  </DataTemplate>
  <ControlTemplate x:Key="GridViewHeaderRowTemplate" TargetType="grid:GridViewHeaderRow">
    <grid:SelectiveScrollingGrid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition />
      </Grid.RowDefinitions>
      <grid:CommonHeaderPresenter x:Name="PART_CommonHeaderPresenter" Grid.Column="3" />
      <Border x:Name="CommonHeaderIndent" Visibility="{Binding Visibility, ElementName=PART_CommonHeaderPresenter}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Grid.ColumnSpan="2" BorderBrush="{StaticResource AccentBrush}" Background="{StaticResource MainBrush}" BorderThickness="0,0,1,0" />
      <Border x:Name="PART_GridViewHeaderRowBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" Grid.Row="1" Grid.ColumnSpan="4" BorderThickness="{TemplateBinding BorderThickness}"></Border>
      <grid:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="3" Grid.Row="1" />
      <Border x:Name="PART_IndicatorPresenter" Width="25" Visibility="{TemplateBinding RowIndicatorVisibility}" BorderBrush="{StaticResource AccentBrush}" BorderThickness="0,0,1,1" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Grid.Row="1" />
      <grid:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="1" MinHeight="{TemplateBinding MinHeight}" IndentLevel="{TemplateBinding IndentLevel}" Grid.Row="1" ItemTemplate="{StaticResource GridViewHeaderIndentCellDataTemplate}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
      <Border x:Name="PART_HierarchyIndentPresenter" Grid.Column="2" Width="25" BorderBrush="Transparent" BorderThickness="0,0,1,0" Grid.Row="1" Visibility="{Binding HasHierarchy, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
    </grid:SelectiveScrollingGrid>
  </ControlTemplate>
  <Style x:Key="GridViewHeaderRowStyle" TargetType="grid:GridViewHeaderRow">
    <Setter Property="Template" Value="{StaticResource GridViewHeaderRowTemplate}" />
    <Setter Property="BorderThickness" Value="0,0,0,1" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="MinHeight" Value="30" />
    <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewHeaderRow" BasedOn="{StaticResource GridViewHeaderRowStyle}" />
  <!--GridViewFooterRow-->
  <DataTemplate x:Key="GridViewFooterIndentCellDataTemplate">
    <grid:GridViewFooterIndentCell />
  </DataTemplate>
  <ControlTemplate x:Key="GridViewFooterRowTemplate" TargetType="grid:GridViewFooterRow">
    <Border x:Name="PART_FooterRowBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
      <grid:SelectiveScrollingGrid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <grid:DataCellsPresenter x:Name="PART_DataCellsPresenter" grid:SelectiveScrollingGrid.SelectiveScrollingClip="True" Grid.Column="3" />
        <Border x:Name="PART_IndicatorPresenter" Width="25" VerticalAlignment="Stretch" Grid.Column="0" Visibility="{TemplateBinding RowIndicatorVisibility}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Grid.RowSpan="3" />
        <grid:IndentPresenter x:Name="PART_IndentPresenter" IndentLevel="{TemplateBinding IndentLevel}" ItemTemplate="{StaticResource GridViewFooterIndentCellDataTemplate}" Grid.Column="1" BorderThickness="0,0,0,0" BorderBrush="{x:Null}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
        <Border x:Name="PART_HierarchyIndent" Width="25" Grid.Column="2" BorderThickness="0,0,0,0" BorderBrush="{x:Null}" Visibility="{Binding HasHierarchy, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
      </grid:SelectiveScrollingGrid>
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewFooterRowStyle" TargetType="grid:GridViewFooterRow">
    <Setter Property="Template" Value="{StaticResource GridViewFooterRowTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="0,0,0,0" />
    <Setter Property="MinHeight" Value="28" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewFooterRow" BasedOn="{StaticResource GridViewFooterRowStyle}" />
  <!--GridViewGroupFooterRow-->
  <DataTemplate x:Key="GridViewGroupFooterIndentCellDataTemplate">
    <grid:GridViewGroupFooterIndentCell />
  </DataTemplate>
  <ControlTemplate x:Key="GridViewGroupFooterRowTemplate" TargetType="grid:GridViewGroupFooterRow">
    <grid:SelectiveScrollingGrid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Border x:Name="PART_HierarchyIndent" Width="25" BorderBrush="{StaticResource BasicBrush}" BorderThickness="0,0,1,0" Grid.Column="2" Visibility="{Binding HasHierarchy, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
      <Border x:Name="PART_FooterRowBorder" Grid.Column="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
      <Border x:Name="PART_IndicatorPresenter" Width="25" VerticalAlignment="Stretch" Grid.Column="0" Margin="0,0,-1,0" Visibility="{TemplateBinding RowIndicatorVisibility}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Grid.RowSpan="3" BorderBrush="{StaticResource BasicBrush}" Background="{StaticResource MainBrush}" BorderThickness="0,0,1,0" />
      <grid:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="3" />
      <grid:IndentPresenter x:Name="PART_IndentPresenter" Margin="1,0,0,0" IndentLevel="{TemplateBinding IndentLevel}" ItemTemplate="{StaticResource GridViewGroupFooterIndentCellDataTemplate}" Grid.Column="1" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" />
    </grid:SelectiveScrollingGrid>
  </ControlTemplate>
  <Style x:Key="GridViewGroupFooterRowStyle" TargetType="grid:GridViewGroupFooterRow">
    <Setter Property="Template" Value="{StaticResource GridViewGroupFooterRowTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="Foreground" Value="{StaticResource StrongBrush}" />
    <Setter Property="MinHeight" Value="28" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="BorderThickness" Value="0,0,0,0" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewGroupFooterRow" BasedOn="{StaticResource GridViewGroupFooterRowStyle}" />
  <!--GridViewCheckBox-->
  <ControlTemplate x:Key="GridViewCheckBoxTemplate" TargetType="grid:GridViewCheckBox">
    <Grid HorizontalAlignment="Left" VerticalAlignment="Center" Width="13" Height="13">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="CheckStates">
          <VisualState x:Name="Checked">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0" Storyboard.TargetName="CheckedPath" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Unchecked" />
          <VisualState x:Name="Indeterminate">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0" Storyboard.TargetName="IndeterminatePath" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Border BorderBrush="{StaticResource BasicBrush}" Background="{StaticResource MainBrush}" BorderThickness="1">
        <Grid>
          <Path x:Name="IndeterminatePath" Data="M14.708333,144.5 L20.667,144.5" HorizontalAlignment="Center" Height="7" Stretch="Fill" Stroke="{StaticResource StrongBrush}" StrokeThickness="1" Visibility="Collapsed" VerticalAlignment="Center" Width="7" />
          <Rectangle x:Name="CheckedPath" StrokeThickness="2" Stroke="{StaticResource MainBrush}" Fill="{StaticResource AccentBrush}" Visibility="Collapsed" />
        </Grid>
      </Border>
    </Grid>
  </ControlTemplate>
  <Style x:Key="GridViewCheckBoxStyle" TargetType="grid:GridViewCheckBox">
    <Setter Property="Template" Value="{StaticResource GridViewCheckBoxTemplate}" />
  </Style>
  <Style TargetType="grid:GridViewCheckBox" BasedOn="{StaticResource GridViewCheckBoxStyle}" />
  <!--GridViewDataControl-->
  <ControlTemplate x:Key="GridViewDataControlTemplate" TargetType="grid:GridViewDataControl">
    <Border Name="PART_MasterGridContainer" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="GridViewActivity">
          <VisualState x:Name="Idle">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GridViewLoadingIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Busy">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GridViewLoadingIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ColumnHeadersVisibility">
          <VisualState x:Name="ColumnHeadersVisible" />
          <VisualState x:Name="ColumnHeadersCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_HeaderRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ColumnFootersVisibility">
          <VisualState x:Name="ColumnFootersVisible" />
          <VisualState x:Name="ColumnFootersCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_FooterRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="GroupPanelVisibility">
          <VisualState x:Name="GroupPanelVisible" />
          <VisualState x:Name="GroupPanelCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GroupPanel" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="DisabledStates">
          <VisualState x:Name="Enabled" />
          <VisualState x:Name="Disabled">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Disabled" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <grid:GridViewGroupPanel x:Name="PART_GroupPanel" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Background="{TemplateBinding GroupPanelBackground}" Foreground="{TemplateBinding GroupPanelForeground}" />
        <StackPanel Grid.Row="1">
          <grid:GridViewHeaderRow x:Name="PART_HeaderRow" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" IndentLevel="{TemplateBinding GroupCount}" />
          <grid:GridViewNewRow Name="PART_AddNewRow" VerticalAlignment="Bottom" HorizontalAlignment="Left" IndentLevel="{TemplateBinding GroupCount}" Visibility="Collapsed" />
        </StackPanel>
        <grid:GridViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel" Grid.Row="2" />
        <StackPanel Grid.Row="3">
          <grid:GridViewFooterRow x:Name="PART_FooterRow" IndentLevel="{TemplateBinding GroupCount}" />
        </StackPanel>
        <grid:ScrollPositionIndicator x:Name="PART_ScrollPositionIndicator" Margin="0,0,28,0" IsHitTestVisible="False" HorizontalAlignment="Right" Grid.Row="2" ContentTemplate="{TemplateBinding ScrollPositionIndicatorTemplate}" Visibility="{Binding IsScrolling, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" />
        <Border x:Name="PART_FrozenColumnsPreview" Grid.Row="1" Visibility="Collapsed" HorizontalAlignment="Left" Grid.RowSpan="3" Background="#33000000" Width="3" />
        <grid:GridViewLoadingIndicator x:Name="PART_GridViewLoadingIndicator" Visibility="Collapsed" IsBusy="{Binding IsBusy, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
        <Rectangle x:Name="Background_Disabled" Fill="{StaticResource MainBrush}" Opacity="0.7" IsHitTestVisible="False" Grid.RowSpan="5" Visibility="Collapsed" />
      </Grid>
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewDataControlStyle" TargetType="grid:GridViewDataControl">
    <Setter Property="Template" Value="{StaticResource GridViewDataControlTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="0,0,0,0" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="Foreground" Value="{StaticResource MarkerBrush}" />
    <Setter Property="AlternateRowBackground" Value="#19767676" />
    <Setter Property="GridLinesVisibility" Value="None" />
    <Setter Property="VerticalGridLinesBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="GroupPanelBackground" Value="{StaticResource AccentBrush}" />
    <Setter Property="GroupPanelForeground" Value="{StaticResource MainBrush}" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewDataControl" BasedOn="{StaticResource GridViewDataControlStyle}" />
  <!--GridViewEditorPresenter-->
  <ControlTemplate x:Key="GridViewEditorPresenter_ValidationToolTipTemplate" TargetType="ToolTip">
    <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="OpenStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="0" />
            <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
              <Storyboard>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
                </DoubleAnimationUsingKeyFrames>
              </Storyboard>
            </VisualTransition>
          </VisualStateGroup.Transitions>
          <VisualState x:Name="Closed">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Open">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid.RenderTransform>
        <TranslateTransform x:Name="xform" X="-25" />
      </Grid.RenderTransform>
      <Border Background="{StaticResource ValidationBrush}">
        <TextBlock Margin="8,3,8,3" MaxWidth="250" Foreground="{StaticResource MainBrush}" Text="{TemplateBinding Content}" TextWrapping="Wrap" />
      </Border>
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="GridViewEditorPresenterTemplate" TargetType="grid:GridViewEditorPresenter">
    <Grid>
      <ContentPresenter Margin="1,1,2,2" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
      <Border x:Name="ValidationErrorElement" Visibility="Collapsed" BorderThickness="1" BorderBrush="{StaticResource ValidationBrush}" Margin="1,1,2,2">
        <ToolTipService.ToolTip>
          <ToolTip x:Name="validationTooltip" Placement="Right" Content="{TemplateBinding ErrorMessage}" Template="{StaticResource GridViewEditorPresenter_ValidationToolTipTemplate}"></ToolTip>
        </ToolTipService.ToolTip>
        <Grid HorizontalAlignment="Right" Height="6" VerticalAlignment="Top" Width="6">
          <Path Fill="{StaticResource ValidationBrush}" Width="4" Height="4" Data="M0,0 L4,0 L4,4 z" />
        </Grid>
      </Border>
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="ValueStates">
          <VisualState x:Name="Valid" />
          <VisualState x:Name="InvalidFocusedState">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
    </Grid>
  </ControlTemplate>
  <Style x:Key="GridViewEditorPresenterStyle" TargetType="grid:GridViewEditorPresenter">
    <Setter Property="Template" Value="{StaticResource GridViewEditorPresenterTemplate}" />
    <Setter Property="VerticalAlignment" Value="Stretch" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="1,1,1,1" />
  </Style>
  <Style TargetType="grid:GridViewEditorPresenter" BasedOn="{StaticResource GridViewEditorPresenterStyle}" />
  <!--GridViewToggleButton-->
  <!--PLUS / MINUS TEMPLATE-->
  <ControlTemplate x:Key="GridViewToggleButtonTemplate" TargetType="controls:GridViewToggleButton">
    <Border Background="Transparent" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
          <VisualState x:Name="MouseOver" />
          <VisualState x:Name="Disabled" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="CheckStates">
          <VisualState x:Name="Checked">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="plus" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="minus" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="minus">
                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource AccentBrush}" />
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Unchecked" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="FocusStates">
          <VisualState x:Name="Focused" />
          <VisualState x:Name="Unfocused" />
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid>
        <Path x:Name="plus" Fill="{StaticResource StrongBrush}" Stretch="Fill" Stroke="{x:Null}" Margin="{TemplateBinding Padding}" Data="M1.937,0 L2.937,0 2.937,2.0209999 5,2.0209999 5,3.0209999 2.937,3.0209999 2.937,5 1.937,5 1.937,3.0209999 0,3.0209999 0,2.0209999 1.937,2.0209999 z" Width="9" Height="9" />
        <Rectangle x:Name="minus" Fill="{StaticResource StrongBrush}" Stroke="{x:Null}" RadiusX="0" RadiusY="0" Margin="{TemplateBinding Padding}" VerticalAlignment="Center" Height="2" HorizontalAlignment="Center" Width="9" Opacity="0" />
      </Grid>
    </Border>
  </ControlTemplate>
  <!--ARROW TEMPLATE-->
  <ControlTemplate x:Key="GridViewToggleButtonArrowTemplate" TargetType="controls:GridViewToggleButton">
    <Border Background="Transparent" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
          <VisualState x:Name="MouseOver" />
          <VisualState x:Name="Disabled" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="CheckStates">
          <VisualState x:Name="Checked">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="plus" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="minus" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="minus">
                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource AccentBrush}" />
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Unchecked" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="FocusStates">
          <VisualState x:Name="Focused" />
          <VisualState x:Name="Unfocused" />
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Border Width="9" Height="9">
        <Grid>
          <Path x:Name="plus" Stretch="Fill" Width="8" Height="4" Data="M0,0 L8,2.3841858E-07 L4,4 z" RenderTransformOrigin="0.5,0.5" Fill="{StaticResource StrongBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}">
            <Path.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleY="-1" />
                <SkewTransform />
                <RotateTransform Angle="90" />
                <TranslateTransform X="9.5006054579016563E-08" Y="-4.6599587300022449E-08" />
              </TransformGroup>
            </Path.RenderTransform>
          </Path>
          <Path x:Name="minus" Stretch="Fill" Width="8" Height="4" Data="M0,0 L8,2.3841858E-07 L4,4 z" RenderTransformOrigin="0.5,0.5" Fill="{StaticResource StrongBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}" Opacity="0">
            <Path.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleY="-1" />
                <SkewTransform />
                <RotateTransform Angle="135" />
                <TranslateTransform X="9.5006054579016563E-08" Y="-4.6599587300022449E-08" />
              </TransformGroup>
            </Path.RenderTransform>
          </Path>
        </Grid>
      </Border>
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewToggleButtonStyle" TargetType="controls:GridViewToggleButton">
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Foreground" Value="{StaticResource MarkerBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="Template" Value="{StaticResource GridViewToggleButtonTemplate}" />
    <Setter Property="PlusMinusTemplate" Value="{StaticResource GridViewToggleButtonTemplate}" />
    <Setter Property="ArrowTemplate" Value="{StaticResource GridViewToggleButtonArrowTemplate}" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="controls:GridViewToggleButton" BasedOn="{StaticResource GridViewToggleButtonStyle}" />
  <!--GridViewGroupPanel-->
  <ControlTemplate x:Key="GridViewGroupPanelTemplate" TargetType="grid:GridViewGroupPanel">
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="Grouping">
          <VisualState x:Name="NoGroups" />
          <VisualState x:Name="HasGroups">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="panelText" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="panelTextGrouped" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <StackPanel Orientation="Horizontal">
        <TextBlock x:Name="panelText" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" telerik:LocalizationManager.ResourceKey="GridViewGroupPanelText" IsHitTestVisible="False" />
        <TextBlock x:Name="panelTextGrouped" Margin="{TemplateBinding Padding}" Visibility="Collapsed" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" telerik:LocalizationManager.ResourceKey="GridViewGroupPanelTopTextGrouped" IsHitTestVisible="False" />
        <ItemsPresenter VerticalAlignment="Center" />
      </StackPanel>
    </Border>
  </ControlTemplate>
  <ItemsPanelTemplate x:Key="GridViewGroupPanelItemsPanelTemplate">
    <StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" />
  </ItemsPanelTemplate>
  <Style x:Key="GridViewGroupPanelStyle" TargetType="grid:GridViewGroupPanel">
    <Setter Property="Template" Value="{StaticResource GridViewGroupPanelTemplate}" />
    <Setter Property="ItemsPanel" Value="{StaticResource GridViewGroupPanelItemsPanelTemplate}" />
    <Setter Property="MinHeight" Value="32" />
    <Setter Property="Margin" Value="0" />
    <Setter Property="Padding" Value="10,0,3,0" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="Background" Value="{StaticResource AccentBrush}" />
    <Setter Property="BorderBrush" Value="{x:Null}" />
    <Setter Property="FontFamily" Value="Segoe UI" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewGroupPanel" BasedOn="{StaticResource GridViewGroupPanelStyle}" />
  <!--GridViewGroupPanelCell-->
  <ControlTemplate x:Key="CloseButtonTemplate" TargetType="Button">
    <Border x:Name="CloseButton" Background="{TemplateBinding Background}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="FocusStates">
          <VisualState x:Name="Unfocused" />
          <VisualState x:Name="Focused" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="MouseOver">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.00" Storyboard.TargetName="closebuttonpath" Storyboard.TargetProperty="Opacity">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Normal" />
          <VisualState x:Name="Pressed" />
          <VisualState x:Name="Disabled" />
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Path Fill="{StaticResource MainBrush}" Stretch="Fill" x:Name="closebuttonpath" Opacity="0.7" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="6" Height="6" Data="M2.76155,0L8.32003,5.57469L13.895,0.0269933L16.482,2.623L10.9074,8.16956L16.4706,13.749L13.8736,16.331L8.31111,10.7527L2.58701,16.448L0,13.854L5.72388,8.15813L0.164554,2.58299z" />
    </Border>
  </ControlTemplate>
  <Style x:Key="ButtonCloseStyle" TargetType="Button">
    <Setter Property="Template" Value="{StaticResource CloseButtonTemplate}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
  </Style>
  <Storyboard x:Key="MouseOver">
    <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="PART_CloseButton" Storyboard.TargetProperty="Opacity">
      <DiscreteDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">
      <DiscreteDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Opacity">
      <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" />
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
      <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="-7" />
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>
  <Storyboard x:Key="MouseOut">
    <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="PART_CloseButton" Storyboard.TargetProperty="Opacity">
      <DiscreteDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
      <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>
  <ControlTemplate x:Key="GridViewGroupPanelCellTemplate" TargetType="grid:GridViewGroupPanelCell">
    <Border x:Name="OuterBorder" Opacity="0.7" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="CommonStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="00:00:00.2" To="MouseOver" />
            <VisualTransition GeneratedDuration="00:00:00.2" To="Normal" />
          </VisualStateGroup.Transitions>
          <VisualState x:Name="Normal" />
          <VisualState x:Name="MouseOver">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.00" Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="-7" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.00" Storyboard.TargetName="PART_CloseButton" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.00" Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.00" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">
                <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="SortDirection">
          <VisualState x:Name="Ascending">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_SortIndicator">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="RenderTransform" Storyboard.TargetName="PART_SortIndicator">
                <DiscreteObjectKeyFrame KeyTime="0:0:0">
                  <DiscreteObjectKeyFrame.Value>
                    <ScaleTransform ScaleY="-1" ScaleX="1" />
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Descending">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="RenderTransform" Storyboard.TargetName="PART_SortIndicator">
                <DiscreteObjectKeyFrame KeyTime="0:0:0">
                  <DiscreteObjectKeyFrame.Value>
                    <ScaleTransform ScaleY="1" ScaleX="1" />
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="None">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid>
        <Path x:Name="PART_SortIndicator" Data="M0,0 L1,0 2,0 3,0 4,0 5,0 5,1 4,1 4,2 3,2 3,3 2,3 2,2 1,2 1,1 0,1 0,0 z" Fill="{StaticResource MainBrush}" HorizontalAlignment="Center" Height="4" Opacity="0.7" Margin="0,1,0,0" RenderTransformOrigin=".5,.5" Stretch="Fill" Visibility="Collapsed" VerticalAlignment="Top" Width="4" />
        <ContentControl x:Name="ContentElement" Content="{TemplateBinding Content}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}" IsTabStop="{TemplateBinding IsTabStop}" Opacity="0.95">
          <ContentControl.RenderTransform>
            <TransformGroup>
              <ScaleTransform />
              <SkewTransform />
              <RotateTransform />
              <TranslateTransform />
            </TransformGroup>
          </ContentControl.RenderTransform>
        </ContentControl>
        <Button x:Name="PART_CloseButton" Style="{StaticResource ButtonCloseStyle}" Margin="4,0" HorizontalAlignment="Right" VerticalAlignment="Center" Opacity="0" />
      </Grid>
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewGroupPanelCellStyle" TargetType="grid:GridViewGroupPanelCell">
    <Setter Property="Template" Value="{StaticResource GridViewGroupPanelCellTemplate}" />
    <Setter Property="Background" Value="{StaticResource AccentBrush}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="BorderBrush" Value="{StaticResource MainBrush}" />
    <Setter Property="Padding" Value="20,0" />
    <Setter Property="MinWidth" Value="95" />
    <Setter Property="MinHeight" Value="22" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
    <Setter Property="FontFamily" Value="Segoe UI Semibold" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewGroupPanelCell" BasedOn="{StaticResource GridViewGroupPanelCellStyle}" />
  <!--GridViewGroupPanelItem-->
  <telerik:InvertedBooleanToOpacityConverter x:Key="InvertedBooleanToOpacityConverter" />
  <ControlTemplate x:Key="GridViewGroupPanelItemTemplate" TargetType="grid:GridViewGroupPanelItem">
    <StackPanel x:Name="PART_GroupPanelItemStackPanel" Orientation="Horizontal" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}">
      <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
        <Grid.RowDefinitions>
          <RowDefinition MinHeight="4" Height="Auto" />
          <RowDefinition />
        </Grid.RowDefinitions>
        <Path x:Name="PART_InsertionPoint" Data="M0,0 L4,0 L4,4 z" Stretch="Fill" RenderTransformOrigin="0.5,0.5" Fill="{StaticResource MainBrush}" HorizontalAlignment="Center" Width="4" Height="4" VerticalAlignment="Top" Margin="0,1,0,0" Opacity="0.7" Visibility="{TemplateBinding InsertionPointVisibility}">
          <Path.RenderTransform>
            <TransformGroup>
              <ScaleTransform />
              <SkewTransform />
              <RotateTransform Angle="135" />
              <TranslateTransform />
            </TransformGroup>
          </Path.RenderTransform>
        </Path>
        <Grid x:Name="PART_ConnectingLine" Opacity="{Binding IsFirst, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InvertedBooleanToOpacityConverter}}" Grid.Row="1" Margin="0,0,0,1">
          <Path Fill="{StaticResource MainBrush}" Opacity="0.7" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Stroke="{x:Null}" Width="5" Data="M0,0L4,0L4,4z" Height="5" Margin="6,0,6,0">
            <Path.RenderTransform>
              <TransformGroup>
                <ScaleTransform />
                <SkewTransform />
                <RotateTransform Angle="45" />
              </TransformGroup>
            </Path.RenderTransform>
          </Path>
        </Grid>
      </Grid>
      <grid:GridViewGroupPanelCell Content="{TemplateBinding Content}" SortDirection="{Binding Path=SortDirection}" x:Name="PART_Cell" />
    </StackPanel>
  </ControlTemplate>
  <Style x:Key="GridViewGroupPanelItemStyle" TargetType="grid:GridViewGroupPanelItem">
    <Setter Property="Template" Value="{StaticResource GridViewGroupPanelItemTemplate}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Padding" Value="2,0,2,2" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
  </Style>
  <Style TargetType="grid:GridViewGroupPanelItem" BasedOn="{StaticResource GridViewGroupPanelItemStyle}" />
  <!--GridViewIndicatorCell-->
  <ControlTemplate x:Key="GridViewIndicatorCellTemplate" TargetType="grid:GridViewIndicatorCell">
    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" />
    </Border>
  </ControlTemplate>
  <Style x:Key="GridViewIndicatorCellStyle" TargetType="grid:GridViewIndicatorCell">
    <Setter Property="Template" Value="{StaticResource GridViewIndicatorCellTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:GridViewIndicatorCell" BasedOn="{StaticResource GridViewIndicatorCellStyle}" />
  <!--GridViewLoadingIndicator-->
  <ControlTemplate x:Key="GridViewLoadingIndicatorTemplate" TargetType="grid:GridViewLoadingIndicator">
    <telerik:RadBusyIndicator IsBusy="True" BusyContent="{x:Null}" />
  </ControlTemplate>
  <Style x:Key="GridViewLoadingIndicatorStyle" TargetType="grid:GridViewLoadingIndicator">
    <Setter Property="Template" Value="{StaticResource GridViewLoadingIndicatorTemplate}" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
  </Style>
  <Style TargetType="grid:GridViewLoadingIndicator" BasedOn="{StaticResource GridViewLoadingIndicatorStyle}" />
  <!--GridViewScrollViewer-->
  <ControlTemplate x:Key="GridViewScrollViewerTemplate" TargetType="grid:GridViewScrollViewer">
    <Grid Name="PART_RootPanel" Background="{TemplateBinding Background}">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <ScrollContentPresenter Grid.Row="2" CanContentScroll="{TemplateBinding CanContentScroll}" />
      <ScrollBar x:Name="PART_VerticalScrollBar" IsTabStop="False" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Grid.Column="1" Grid.Row="0" Grid.RowSpan="4" Orientation="Vertical" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0.0" Value="{Binding VerticalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
      <ScrollBar x:Name="PART_HorizontalScrollBar" IsTabStop="False" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Grid.Column="0" Grid.Row="4" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0.0" Value="{Binding HorizontalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
      <Rectangle Grid.Column="1" Grid.Row="4" Fill="{StaticResource MainBrush}" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="GridViewScrollViewerStyle" TargetType="grid:GridViewScrollViewer">
    <Setter Property="Template" Value="{StaticResource GridViewScrollViewerTemplate}" />
  </Style>
  <Style TargetType="grid:GridViewScrollViewer" BasedOn="{StaticResource GridViewScrollViewerStyle}" />
  <!--IndentPresenter-->
  <ControlTemplate x:Key="IndentPresenterTemplate" TargetType="grid:IndentPresenter">
    <Grid>
      <ItemsPresenter />
    </Grid>
  </ControlTemplate>
  <DataTemplate x:Key="IndentPresenterItemTemplate">
    <grid:GridViewIndentCell />
  </DataTemplate>
  <ItemsPanelTemplate x:Key="IndentPresenterItemsPanelTemplate">
    <StackPanel Orientation="Horizontal" />
  </ItemsPanelTemplate>
  <Style x:Key="IndentPresenterStyle" TargetType="grid:IndentPresenter">
    <Setter Property="Template" Value="{StaticResource IndentPresenterTemplate}" />
    <Setter Property="ItemTemplate" Value="{StaticResource IndentPresenterItemTemplate}" />
    <Setter Property="ItemsPanel" Value="{StaticResource IndentPresenterItemsPanelTemplate}" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:IndentPresenter" BasedOn="{StaticResource IndentPresenterStyle}" />
  <!--IndicatorPresenter-->
  <ControlTemplate x:Key="IndicatorPresenterTemplate" TargetType="grid:IndicatorPresenter">
    <Grid x:Name="PART_IndicatorGrid">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
      </Grid.ColumnDefinitions>
      <grid:GridViewIndicatorCell IsTabStop="{TemplateBinding IsTabStop}" Background="{TemplateBinding Background}" Content="{TemplateBinding Content}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="IndicatorPresenterStyle" TargetType="grid:IndicatorPresenter">
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template" Value="{StaticResource IndicatorPresenterTemplate}" />
  </Style>
  <Style TargetType="grid:IndicatorPresenter" BasedOn="{StaticResource IndicatorPresenterStyle}" />
  <!--RadGridView-->
  <ControlTemplate x:Key="RadGridViewTemplate" TargetType="controls:RadGridView">
    <Border Name="PART_MasterGridContainer" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="GridViewActivity">
          <VisualState x:Name="Idle">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GridViewLoadingIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Busy">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GridViewLoadingIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ColumnHeadersVisibility">
          <VisualState x:Name="ColumnHeadersVisible">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_HeaderRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="ColumnHeadersCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_HeaderRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ColumnFootersVisibility">
          <VisualState x:Name="ColumnFootersVisible">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_FooterRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="ColumnFootersCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_FooterRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="GroupPanelVisibility">
          <VisualState x:Name="GroupPanelVisible">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GroupPanel" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="GroupPanelCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GroupPanel" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="InsertRowVisibility">
          <VisualState x:Name="InsertRowVisible">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_AddNewRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="InsertRowCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_AddNewRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="DisabledStates">
          <VisualState x:Name="Enabled" />
          <VisualState x:Name="Disabled">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Disabled" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid x:Name="HierrarchyBackground">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition x:Name="PART_AttachedBehaviorRow" Height="Auto" />
          <RowDefinition />
          <RowDefinition x:Name="ScrollBarRow" MinHeight="0" Height="0" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition />
          <ColumnDefinition x:Name="ScrollBarColumn" MinWidth="0" Width="0" />
        </Grid.ColumnDefinitions>
        <grid:GridViewGroupPanel x:Name="PART_GroupPanel" Grid.Row="0" Grid.ColumnSpan="2" Background="{TemplateBinding GroupPanelBackground}" Foreground="{TemplateBinding GroupPanelForeground}" />
        <grid:GridViewScrollViewer x:Name="PART_ItemsScrollViewer" Background="Transparent" CanContentScroll="True" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2">
          <grid:GridViewScrollViewer.HeaderRow>
            <grid:GridViewHeaderRow x:Name="PART_HeaderRow" IndentLevel="{TemplateBinding GroupCount}" />
          </grid:GridViewScrollViewer.HeaderRow>
          <grid:GridViewScrollViewer.NewRow>
            <grid:GridViewNewRow Name="PART_AddNewRow" IndentLevel="{TemplateBinding GroupCount}" Visibility="Collapsed" />
          </grid:GridViewScrollViewer.NewRow>
          <grid:GridViewScrollViewer.FooterRow>
            <grid:GridViewFooterRow x:Name="PART_FooterRow" IndentLevel="{TemplateBinding GroupCount}" />
          </grid:GridViewScrollViewer.FooterRow>
          <grid:GridViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel" />
        </grid:GridViewScrollViewer>
        <grid:ScrollPositionIndicator x:Name="PART_ScrollPositionIndicator" Margin="0,0,28,0" IsHitTestVisible="False" HorizontalAlignment="Right" Grid.Row="2" Grid.ColumnSpan="2" Visibility="{Binding IsScrolling, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" ContentTemplate="{TemplateBinding ScrollPositionIndicatorTemplate}" />
        <Border x:Name="PART_FrozenColumnsPreview" Grid.Row="1" Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.RowSpan="4" Background="#33000000" Width="5" />
        <grid:GridViewLoadingIndicator x:Name="PART_GridViewLoadingIndicator" Visibility="Collapsed" IsBusy="{Binding IsBusy, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Grid.RowSpan="4" Grid.ColumnSpan="2" />
        <Rectangle x:Name="Background_Disabled" Fill="{StaticResource MainBrush}" Opacity="0.7" IsHitTestVisible="False" Grid.RowSpan="5" Visibility="Collapsed" />
      </Grid>
    </Border>
  </ControlTemplate>
  <Style x:Key="RadGridViewStyle" TargetType="controls:RadGridView">
    <Setter Property="Template" Value="{StaticResource RadGridViewTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="Foreground" Value="{StaticResource MarkerBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="AlternateRowBackground" Value="#19767676" />
    <Setter Property="GridLinesVisibility" Value="None" />
    <Setter Property="VerticalGridLinesBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="GroupPanelBackground" Value="{StaticResource AccentBrush}" />
    <Setter Property="GroupPanelForeground" Value="{StaticResource MainBrush}" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="VerticalAlignment" Value="Stretch" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="FontFamily" Value="Segoe UI" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="controls:RadGridView" BasedOn="{StaticResource RadGridViewStyle}" />
  <!--RadTreeListView-->
  <Style x:Key="TreeListViewDragCueStyle" TargetType="controls:TreeListViewDragCue">
    <Setter Property="IsHitTestVisible" Value="False" />
    <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
    <Setter Property="Padding" Value="3,0" />
    <Setter Property="FontSize" Value="11" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="controls:TreeListViewDragCue">
          <StackPanel>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="DropStates">
                <VisualState x:Name="DropPossible" />
                <VisualState x:Name="DropImpossible">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropImpossibleIconElement" Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropPossibleIconElement" Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid HorizontalAlignment="Left" Visibility="{TemplateBinding DragPreviewVisibility}" MinHeight="18">
              <Border Background="{StaticResource AccentBrush}">
                <ItemsPresenter Margin="{TemplateBinding Padding}" />
              </Border>
              <Grid x:Name="DraggedItemsCountContainer" Visibility="Collapsed" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center">
                <Border BorderBrush="{StaticResource BasicBrush}" Background="{StaticResource MainBrush}" MinHeight="18" BorderThickness="1" Margin="0,2,0,0" Padding="40" />
                <TextBlock Margin="3" x:Name="DraggedItemsCountText" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Text="5" />
              </Grid>
            </Grid>
            <Border BorderBrush="{StaticResource BasicBrush}" Background="{StaticResource MainBrush}" MinHeight="18" BorderThickness="1" CornerRadius="1" Margin="0,2,0,0" Padding="4,4,0,0" Visibility="{TemplateBinding DragTooltipVisibility}">
              <StackPanel Orientation="Horizontal">
                <ContentPresenter x:Name="DropImpossibleIconElement" Content="{TemplateBinding DropImpossibleIcon}" ContentTemplate="{TemplateBinding DropImpossibleIconTemplate}" Visibility="Collapsed" />
                <ContentPresenter x:Name="DropPossibleIconElement" Content="{TemplateBinding DropPossibleIcon}" ContentTemplate="{TemplateBinding DropPossibleIconTemplate}" />
                <ContentControl Margin="4,0,0,0" Content="{TemplateBinding DragActionContent}" ContentTemplate="{TemplateBinding DragActionContentTemplate}" VerticalAlignment="Center" Foreground="{StaticResource StrongBrush}" />
                <ContentControl Foreground="{StaticResource StrongBrush}" Content="{TemplateBinding DragTooltipContent}" ContentTemplate="{TemplateBinding DragTooltipContentTemplate}" VerticalAlignment="Center" />
              </StackPanel>
            </Border>
          </StackPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="DropImpossibleIcon" Value="The icon is assigned as DataTemplate because assigning as Content triggers a bug in Silverlight" />
    <Setter Property="DropImpossibleIconTemplate">
      <Setter.Value>
        <DataTemplate>
          <Grid>
            <Path Fill="{StaticResource ValidationBrush}" Stretch="Fill" Margin="0,0,0,6" StrokeThickness="0.5" Width="11" Height="11" Data="M2.0090871,3.5463004 L1.9827784,3.5933623 C1.6748887,4.1601357 1.5,4.8096442 1.5,5.5 1.5,7.7091389 3.2908609,9.5 5.5,9.5 6.1903558,9.5 6.8398643,9.3251114 7.4066377,9.0172215 L7.4536991,8.9909134 z M5.5,1.5 C4.7406082,1.5 4.0306425,1.7116154 3.4258544,2.0790935 L3.3916554,2.1004417 8.8995581,7.6083441 8.9209061,7.5741453 C9.2883844,6.9693575 9.5,6.2593913 9.5,5.5 9.5,3.2908609 7.7091389,1.5 5.5,1.5 z M5.5,0 C8.5375662,0 11,2.4624338 11,5.5 11,8.5375662 8.5375662,11 5.5,11 2.4624338,11 0,8.5375662 0,5.5 0,2.4624338 2.4624338,0 5.5,0 z" />
          </Grid>
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="DropPossibleIcon" Value="The icon is assigned as DataTemplate because assigning as Content triggers a bug in Silverlight" />
    <Setter Property="DropPossibleIconTemplate">
      <Setter.Value>
        <DataTemplate>
          <Grid>
            <Path Stretch="Fill" Fill="{StaticResource StrongBrush}" Data="M0,-0.76793623 L2,-0.76793623 L3.0774765,0.30954036 L3.0857141,-5.9258094 L4.956666,-5.9187422 L4.9660869,0.26597711 L6,-0.76793599 L8,-0.76793599 L4,4.0282435 z" Width="7" Height="7" RenderTransformOrigin="0.5,0.5">
              <Path.RenderTransform>
                <TransformGroup>
                  <ScaleTransform />
                  <SkewTransform />
                  <RotateTransform Angle="-90" />
                  <TranslateTransform X="2.9845001144409182" Y="-2.984500114440916" />
                </TransformGroup>
              </Path.RenderTransform>
            </Path>
          </Grid>
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="controls:TreeListViewDragCue" BasedOn="{StaticResource TreeListViewDragCueStyle}" />
  <ControlTemplate x:Key="RadTreeListViewTemplate" TargetType="controls:RadTreeListView">
    <Border Name="PART_MasterGridContainer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="GridViewActivity">
          <VisualState x:Name="Idle">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GridViewLoadingIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Busy">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_GridViewLoadingIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ColumnHeadersVisibility">
          <VisualState x:Name="ColumnHeadersVisible">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_HeaderRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="ColumnHeadersCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_HeaderRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ColumnFootersVisibility">
          <VisualState x:Name="ColumnFootersVisible">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_FooterRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="ColumnFootersCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_FooterRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="InsertRowVisibility">
          <VisualState x:Name="InsertRowVisible">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_AddNewRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="InsertRowCollapsed">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_AddNewRow" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Collapsed</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid Background="{TemplateBinding Background}" x:Name="HierrarchyBackground">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition x:Name="PART_AttachedBehaviorRow" Height="Auto" />
          <RowDefinition />
          <RowDefinition x:Name="ScrollBarRow" MinHeight="0" Height="0" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition />
          <ColumnDefinition x:Name="ScrollBarColumn" MinWidth="0" Width="0" />
        </Grid.ColumnDefinitions>
        <Border x:Name="PART_FrozenColumnsPreview" Grid.Row="1" Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.RowSpan="4" Width="5" />
        <grid:GridViewScrollViewer x:Name="PART_ItemsScrollViewer" Background="Transparent" CanContentScroll="True" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2">
          <grid:GridViewScrollViewer.HeaderRow>
            <grid:GridViewHeaderRow x:Name="PART_HeaderRow" IndentLevel="{TemplateBinding GroupCount}" />
          </grid:GridViewScrollViewer.HeaderRow>
          <grid:GridViewScrollViewer.NewRow>
            <grid:GridViewNewRow Name="PART_AddNewRow" IndentLevel="{TemplateBinding GroupCount}" Visibility="Collapsed" />
          </grid:GridViewScrollViewer.NewRow>
          <grid:GridViewScrollViewer.FooterRow>
            <grid:GridViewFooterRow x:Name="PART_FooterRow" IndentLevel="{TemplateBinding GroupCount}" />
          </grid:GridViewScrollViewer.FooterRow>
          <treelist:TreeListViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel" />
        </grid:GridViewScrollViewer>
        <grid:ScrollPositionIndicator x:Name="PART_ScrollPositionIndicator" Margin="0,0,28,0" IsHitTestVisible="False" HorizontalAlignment="Right" Grid.Row="2" Grid.ColumnSpan="2" Visibility="{Binding IsScrolling, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" ContentTemplate="{TemplateBinding ScrollPositionIndicatorTemplate}" />
        <grid:GridViewLoadingIndicator x:Name="PART_GridViewLoadingIndicator" Visibility="Collapsed" Grid.RowSpan="4" Grid.ColumnSpan="2" IsBusy="{Binding IsBusy, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
        <Grid x:Name="DragBetweenItemsFeedback" Grid.Row="2" Height="8" Visibility="Collapsed" HorizontalAlignment="Left" IsHitTestVisible="False" VerticalAlignment="Top" Margin="{TemplateBinding Padding}">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="8" />
            <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <Ellipse Stroke="{StaticResource AccentBrush}" StrokeThickness="2" HorizontalAlignment="Left" VerticalAlignment="Center" Width="8" Height="8" />
          <Rectangle Fill="{StaticResource AccentBrush}" RadiusX="2" RadiusY="2" Margin="-2,3,0,0" VerticalAlignment="Top" Height="2" Grid.Column="1" />
        </Grid>
        <Rectangle x:Name="Background_Disabled" Fill="{StaticResource MainBrush}" Opacity="0.7" IsHitTestVisible="False" Grid.RowSpan="5" Visibility="Collapsed" />
      </Grid>
    </Border>
  </ControlTemplate>
  <Style x:Key="RadTreeListViewStyle" TargetType="controls:RadTreeListView">
    <Setter Property="Template" Value="{StaticResource RadTreeListViewTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="Foreground" Value="{StaticResource StrongBrush}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="GridLinesVisibility" Value="None" />
    <Setter Property="AlternateRowBackground" Value="#19767676" />
    <Setter Property="VerticalGridLinesBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="VerticalAlignment" Value="Stretch" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="FontFamily" Value="Segoe UI Semibold" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="controls:RadTreeListView" BasedOn="{StaticResource RadTreeListViewStyle}" />
  <!--TreeListViewRow-->
  <ControlTemplate x:Key="TreeListViewRowTemplate" TargetType="treelist:TreeListViewRow">
    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="FocusStates">
          <VisualState x:Name="Unfocused" />
          <VisualState x:Name="Focused">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NavigatorIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="SelectionStates">
          <VisualState x:Name="Unselected" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
          <VisualState x:Name="MouseOver">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="Background_Over" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Selected">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Selected" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_DataCellsPresenter" Storyboard.TargetProperty="Foreground">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource MarkerBrush}" />
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="ValueStates">
          <VisualState x:Name="RowValid" />
          <VisualState x:Name="RowInvalid">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Invalid" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ErrorIndicator" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <grid:SelectiveScrollingGrid x:Name="grid" Background="Transparent">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="*" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Grid.Column="2" x:Name="PART_SelectiveScrollingElements">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
          </Grid.ColumnDefinitions>
          <Border x:Name="SelectionBackground" Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" Grid.ColumnSpan="2" />
          <Border x:Name="PART_RowBorder" BorderBrush="{TemplateBinding HorizontalGridLinesBrush}" BorderThickness="{Binding HorizontalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Bottom}" Grid.ColumnSpan="3" Grid.Column="1" Grid.RowSpan="4" VerticalAlignment="Bottom" />
          <Rectangle x:Name="Background_Over" Visibility="Collapsed" Fill="{StaticResource StrongBrush}" Opacity="0.2" Grid.Column="1" />
          <Rectangle x:Name="Background_Selected" Visibility="Collapsed" Fill="{StaticResource BasicBrush}" Grid.Column="1" />
          <Rectangle x:Name="Background_Invalid" Visibility="Collapsed" Stroke="{StaticResource ValidationBrush}" Fill="{StaticResource MainBrush}" StrokeThickness="1" Grid.Column="1" Margin="1,0" />
        </Grid>
        <controls:GridViewToggleButton x:Name="PART_ExpandButton" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Width="20" Grid.Column="1" Grid.ColumnSpan="2" PresentationMode="Arrow" IsTabStop="False" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
        <grid:DataCellsPresenter Grid.ColumnSpan="2" Grid.Column="1" x:Name="PART_DataCellsPresenter">
          <grid:DataCellsPresenter.ItemsPanel>
            <ItemsPanelTemplate>
              <treelist:TreeListCellsPanel />
            </ItemsPanelTemplate>
          </grid:DataCellsPresenter.ItemsPanel>
        </grid:DataCellsPresenter>
        <grid:DetailsPresenter x:Name="PART_DetailsPresenter" Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="1" Visibility="Collapsed" DetailsProvider="{TemplateBinding DetailsProvider}" />
        <Border x:Name="PART_IndicatorPresenter" Width="25" VerticalAlignment="Stretch" Grid.Column="0" Visibility="{TemplateBinding RowIndicatorVisibility}" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Grid.RowSpan="3" Background="{StaticResource MainBrush}">
          <Grid>
            <Grid x:Name="NavigatorIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="9" Height="9" Visibility="Collapsed">
              <Path x:Name="plus" Stretch="Fill" Width="8" Height="4" Data="M0,0 L8,2.3841858E-07 L4,4 z" RenderTransformOrigin="0.5,0.5" Fill="{StaticResource AccentBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}">
                <Path.RenderTransform>
                  <TransformGroup>
                    <ScaleTransform ScaleY="-1" />
                    <SkewTransform />
                    <RotateTransform Angle="90" />
                    <TranslateTransform X="9.5006054579016563E-08" Y="-4.6599587300022449E-08" />
                  </TransformGroup>
                </Path.RenderTransform>
              </Path>
            </Grid>
            <Border x:Name="EditIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="12" Height="10" Visibility="Collapsed" Background="{StaticResource MainBrush}" BorderBrush="{StaticResource StrongBrush}" BorderThickness="1">
              <Path Fill="{StaticResource StrongBrush}" Stretch="Fill" Data="M3,2 L4,2 L5,2 L6,2 L6,3 L5,3 L5,4 L5,5 L5,6 L5,7 L6,7 L6,8 L5,8 L4,8 L3,8 L3,7 L4,7 L4,6 L4,5 L4,4 L4,3 L3,3 z" HorizontalAlignment="Left" Margin="1,1,0,1" Width="3" Height="6" />
            </Border>
            <Grid x:Name="ErrorIndicator" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed">
              <Ellipse Fill="{StaticResource MainBrush}" Width="16" Height="16" Stroke="{StaticResource ValidationBrush}" />
              <Path Data="M1.0000001,8 C1.5522848,8 2.0000002,8.4477148 2.0000002,9 C2.0000002,9.5522842 1.5522848,10 1.0000001,10 C0.4477154,10 1.527369E-07,9.5522842 1.4901161E-07,9 C1.527369E-07,8.4477148 0.4477154,8 1.0000001,8 z M0,0 L2,0 L2,7 L0,7 z" Fill="{StaticResource ValidationBrush}" Width="2" Height="10" Stretch="Fill" />
            </Grid>
            <Border x:Name="PART_RowResizer" Background="Transparent" Height="4" VerticalAlignment="Bottom" Cursor="SizeNS" />
          </Grid>
        </Border>
      </grid:SelectiveScrollingGrid>
    </Border>
  </ControlTemplate>
  <Style x:Key="TreeListViewRowStyle" TargetType="treelist:TreeListViewRow">
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template" Value="{StaticResource TreeListViewRowTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="AllowDrop" Value="True" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="treelist:TreeListViewRow" BasedOn="{StaticResource TreeListViewRowStyle}" />
  <!--LookupElement-->
  <ControlTemplate x:Key="NonEditableComboBox" TargetType="input:RadComboBox">
    <Grid x:Name="VisualRoot">
      <ContentPresenter x:Name="Content" Grid.Column="0" Margin="{TemplateBinding Padding}" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="LookupElementTemplate" TargetType="grid:LookupElement">
    <input:RadComboBox x:Name="PART_RadComboBox" Foreground="{Binding Foreground,RelativeSource={RelativeSource TemplatedParent}}" NonEditableTemplate="{StaticResource NonEditableComboBox}" ItemTemplate="{Binding ItemTemplate,RelativeSource={RelativeSource TemplatedParent}}" SelectedValuePath="{Binding SelectedValuePath,RelativeSource={RelativeSource TemplatedParent}}" DisplayMemberPath="{Binding DisplayMemberPath,RelativeSource={RelativeSource TemplatedParent}}" SelectedValue="{Binding SelectedValue,RelativeSource={RelativeSource TemplatedParent}}" ItemsSource="{Binding ItemsSource,RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="{TemplateBinding IsTabStop}" />
  </ControlTemplate>
  <Style x:Key="LookupElementStyle" TargetType="grid:LookupElement">
    <Setter Property="Template" Value="{StaticResource LookupElementTemplate}" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="IsHitTestVisible" Value="False" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:LookupElement" BasedOn="{StaticResource LookupElementStyle}" />
  <!--ScrollPositionIndicator-->
  <ControlTemplate x:Key="ScrollPositionIndicatorTemplate" TargetType="grid:ScrollPositionIndicator">
    <Border HorizontalAlignment="Right" VerticalAlignment="Center" Width="Auto" Height="Auto" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
      <ContentPresenter Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
    </Border>
  </ControlTemplate>
  <Style x:Key="ScrollPositionIndicatorStyle" TargetType="grid:ScrollPositionIndicator">
    <Setter Property="Template" Value="{StaticResource ScrollPositionIndicatorTemplate}" />
    <Setter Property="Background" Value="{StaticResource MainBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource BasicBrush}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="Padding" Value="15,5" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>
  <Style TargetType="grid:ScrollPositionIndicator" BasedOn="{StaticResource ScrollPositionIndicatorStyle}" />
</ResourceDictionary>