<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
					xmlns:vistaCopy="clr-namespace:VistaThemeCopy"
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:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
					xmlns:dataPager="clr-namespace:Telerik.Windows.Controls.DataPager;assembly=Telerik.Windows.Controls.GridView"
				
				
			
					>
    
	<SolidColorBrush x:Key="ControlOuterBorder" Color="#FF83A5D2" />
<SolidColorBrush x:Key="ControlInnerBorder" Color="#FFFFFFFF" />
<vistaCopy:VistaThemeCopyTheme x:Key="Theme" />
<SolidColorBrush x:Key="GridView_GroupRowIndicator" Color="#FF1768BA" />
<SolidColorBrush x:Key="GridView_RowIndicatorCellBackground" Color="#FFE1F1F9" />
<SolidColorBrush x:Key="GridView_GroupRowBackground" Color="#FFE1F1F9" />
<SolidColorBrush x:Key="GridView_GridLinesItemBorder" Color="#FFB0B0B0" />

	
    
    <Storyboard x:Key="Expand">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
            <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="180"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    <Storyboard x:Key="Collapse">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
            <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    

	<DataTemplate x:Key="GroupHeaderTemplate">
		<ContentPresenter 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" Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition x:Name="PART_HeaderRow" MinHeight="25" />
                <RowDefinition x:Name="ContentRow" />
            </Grid.RowDefinitions>

			

			<Border x:Name="ToggleButtonBorder" BorderBrush="{StaticResource ControlOuterBorder}" Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" Grid.Column="2" Grid.ColumnSpan="2">
				<Border x:Name="ToggleButtonInnerBorder" BorderBrush="{StaticResource ControlInnerBorder}" BorderThickness="1" >

					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="25" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
						</Grid.ColumnDefinitions>

						<!--Aggregates-->
						<Border 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}" telerik:StyleManager.Theme="{StaticResource Theme}" />
									</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 ControlOuterBorder}" Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" HorizontalAlignment="Stretch" grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
								Margin="-1,-1,0,-2">
							<Border x:Name="IconInnerBorder"  BorderBrush="{StaticResource ControlInnerBorder}" BorderThickness="1,1,0,1" >
								<Path x:Name="ExpanderButton" Grid.Column="0"
									  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
									  Margin="{TemplateBinding Padding}" 
									  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
									  Fill="{StaticResource GridView_GroupRowIndicator}"
									  Width="7" Height="5"
									  Data="M0,0L1,0 2,0 2,0.99999991 3,0.99999991 3,2 4,2 4,0.99999991 5,0.99999991 5,0 5.9999999,0 7,0 7,0.99999991 5.9999999,0.99999991 5.9999999,2 5,2 5,3 4,3 4,4 3,4 3,3 2,3 2,2 1,2 1,0.99999991 0,0.99999991z"
									  RenderTransformOrigin="0.5,0.5">
									<Path.RenderTransform>
										<RotateTransform />
									</Path.RenderTransform>
								</Path>
							</Border>
						</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" />
						
						<!--GroupHeader-->
						<ToggleButton Grid.Column="1" Padding="0,0,10,0"
									  grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" 
									  Background="{TemplateBinding Background}" BorderThickness="0" BorderBrush="{x:Null}" 
									  Style="{StaticResource GridViewGroupToggleButtonStyle}"
									  IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">						
							<ContentPresenter Grid.Column="1" Margin="0,0,10,0" Content="{TemplateBinding GroupViewModel}" VerticalAlignment="Center" ContentTemplate="{TemplateBinding GroupHeaderTemplate}" />
						</ToggleButton>
						
					</Grid>
				</Border>
			</Border>

			<!--Indicator-->
			<Border x:Name="PART_IndicatorPresenter"
							Width="25"
							VerticalAlignment="Stretch"
							Grid.Column="0"
							Visibility="{TemplateBinding RowIndicatorVisibility}"
							grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
							BorderBrush="{StaticResource ControlOuterBorder}"
							BorderThickness="0,0,1,1">
				<Border Background="{StaticResource GridView_RowIndicatorCellBackground}" 
						BorderBrush="{StaticResource ControlInnerBorder}" 
						BorderThickness="1" />
			</Border>

			<!--Indent-->
			<grid:IndentPresenter grid:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" 
								  IndentLevel="{TemplateBinding Level}" Background="{TemplateBinding Background}"
								  Grid.Column="1" 
								  telerik:StyleManager.Theme="{StaticResource Theme}" />

			<!--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" telerik:StyleManager.Theme="{StaticResource Theme}" />
				</StackPanel>
			</Border>

			<Border x:Name="BottomBorder" Grid.Column="2" Grid.Row="1" BorderThickness="0,0,0,1" BorderBrush="{StaticResource ControlOuterBorder}" VerticalAlignment="Bottom" Visibility="Collapsed" />
		</Grid>
     
        
        <ControlTemplate.Triggers>
            <Trigger Property="IsExpanded" Value="True">
				<Setter Property="Visibility" TargetName="BottomBorder" Value="Visible" />
                <Setter Property="Visibility" TargetName="Content" Value="Visible" />
				<Setter Property="BorderThickness" TargetName="IconOuterBorder" Value="0,0,0,0" />
				<Setter Property="BorderThickness" TargetName="IconInnerBorder" Value="1,1,0,0" />
				<Trigger.EnterActions>
					<BeginStoryboard Storyboard="{StaticResource Expand}" />
				</Trigger.EnterActions>
				<Trigger.ExitActions>
					<BeginStoryboard Storyboard="{StaticResource Collapse}" />
				</Trigger.ExitActions>
            </Trigger>
        </ControlTemplate.Triggers>
        
    </ControlTemplate>

    <Style 
        
        x:Key="{telerik:ThemeResourceKey ThemeType=vistaCopy:VistaThemeCopyTheme, ElementType=grid:GridViewGroupRow}"
        
        TargetType="grid:GridViewGroupRow">
        <Setter Property="Template" Value="{StaticResource GridViewGroupRowTemplate}" />
		<Setter Property="GroupHeaderTemplate" Value="{StaticResource GroupHeaderTemplate}" />        
		<Setter Property="Background" Value="{StaticResource GridView_GroupRowBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource GridView_GridLinesItemBorder}" />
		<Setter Property="BorderThickness" Value="0" />
		<Setter Property="VerticalContentAlignment" Value="Center" />
		<Setter Property="HorizontalContentAlignment" Value="Left" />
		<Setter Property="Padding" Value="10,0,0,0" />
		
        
		<Setter Property="SnapsToDevicePixels" Value="True" />
		
    </Style>
    
	
</ResourceDictionary>