<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:local="clr-namespace:CustomThemeBasedOnOfficeBlack_GridWpf;assembly=CustomThemeBasedOnOfficeBlack_GridWpf"
        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"
    
     >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Resources.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
	
	<!--CloseButton-->
	<SolidColorBrush x:Key="GridViewGroupPanelButtonCloseIcon" Color="#FF000000" />
	<SolidColorBrush x:Key="GridViewGroupCellButtonBorder" Color="#FF7F7F7F" />
	<LinearGradientBrush x:Key="GridViewGroupCellCloseButton" EndPoint="0.5,1" StartPoint="0.5,0">
		<GradientStop Color="#FFF8F8F9" Offset="0"/>
		<GradientStop Color="#FFDBDEE1" Offset="1"/>
		<GradientStop Color="#FFDFE2E5" Offset="0.4"/>
		<GradientStop Color="#FFC7CBD1" Offset="0.4"/>
	</LinearGradientBrush>
	<SolidColorBrush x:Key="GridViewGroupCellButtonBorder_Over" Color="#FFFFAB3F" />
	<LinearGradientBrush x:Key="GridViewGroupCellCloseButton_Over" EndPoint="0.5,1" StartPoint="0.5,0">
		<GradientStop Color="#FFFFD9AA" Offset="0"/>
		<GradientStop Color="#FFFEE07A" Offset="1"/>
		<GradientStop Color="#FFFFBC6F" Offset="0.4"/>
		<GradientStop Color="#FFFFAB3F" Offset="0.4"/>
	</LinearGradientBrush>

	<ControlTemplate x:Key="CloseButtonTemplate" TargetType="Button">
		<Grid Width="9" Height="9">
			<Border x:Name="CloseButton" BorderBrush="{StaticResource GridViewGroupCellButtonBorder}" BorderThickness="1,1,1,1" CornerRadius="1,1,1,1"
					Background="{StaticResource GridViewGroupCellCloseButton}" >
				<Path Fill="{StaticResource GridViewGroupPanelButtonCloseIcon}" Stretch="Fill" Stroke="{x:Null}" Margin="0.943,0.834,1.057,1.166" Data="M4,4 L5,4 5,5 4,5 z M0,4 L1,4 1,5 0,5 z M3,3 L4,3 4,4 3,4 z M1,3 L2,3 2,4 1,4 z M2,2 L3,2 3,3 2,3 z M4,0 L5,0 5,1 4,1 4,2 3,2 3,0.99999994 4,0.99999994 z M0,0 L1,0 1,0.99999994 2,0.99999994 2,2 1,2 1,1 0,1 z"/>
			</Border>
			
		</Grid>
		
		<ControlTemplate.Triggers>
			<Trigger Property="IsMouseOver" Value="True">
				<Setter TargetName="CloseButton" Property="Background" Value="{StaticResource GridViewGroupCellButtonBorder_Over}" />
				<Setter TargetName="CloseButton" Property="BorderBrush" Value="{StaticResource GridViewGroupCellButtonBorder_Over}" />
			</Trigger>
			<Trigger Property="IsFocused" Value="True"/>
			<Trigger Property="IsDefaulted" Value="True"/>
			<Trigger Property="IsPressed" Value="True"/>
			<Trigger Property="IsEnabled" Value="False"/>
		</ControlTemplate.Triggers>
		
	</ControlTemplate>

	<Style x:Key="ButtonCloseStyle" TargetType="Button">
		<Setter Property="Template" Value="{StaticResource CloseButtonTemplate}" />
	</Style>



	<ControlTemplate x:Key="GridViewGroupPanelCellTemplate" TargetType="grid:GridViewGroupPanelCell">

        <Border Background="{x:Null}" BorderBrush="{StaticResource GridViewGroupPanelCellBorderBrush}" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4" Margin="0,0,0,10">
            <Border Width="Auto" Height="Auto"  BorderBrush="{StaticResource GridViewGroupPanelCellInnerBorderBrush}" BorderThickness="0,0,0,0" Background="{StaticResource GridViewHeaderBackground}" CornerRadius="3,3,3,3">

                <Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="10" />
							<ColumnDefinition Width="20" />
                        </Grid.ColumnDefinitions>
						<Button x:Name="PART_CloseButton" Grid.Column="2" Style="{StaticResource ButtonCloseStyle}"
								HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,3,3,0"/>
						<Path x:Name="PART_SortIndicator" Grid.Column="1" 
                              Fill="{StaticResource GridViewGroupPanelCellSortIndicatorFill}" 
                              Stretch="Fill" 
                              Stroke="{x:Null}" 
                              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" 
                              HorizontalAlignment="Right" VerticalAlignment="Center" Width="5" Height="3"
                              RenderTransformOrigin="0.5,0.5"
							  Margin="0,0,3,0" Visibility="Collapsed">
                         
                        </Path>
                        
                        <ContentPresenter Margin="3,4,2,3" TextElement.FontWeight="Bold"
								TextElement.Foreground="{StaticResource GridViewGroupPanelCellForeground}" Grid.Column="0"
								Content="{Binding Path=DisplayContent}" />
                        
                        
					</Grid>
                </Grid>


            </Border>
            
        </Border>
        
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=SortDirection}" Value="Ascending">
                <Setter Property="Visibility" TargetName="PART_SortIndicator" Value="Visible" />
                <Setter Property="LayoutTransform" TargetName="PART_SortIndicator">
                    <Setter.Value>
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </Setter.Value>
                </Setter>
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=SortDirection}" Value="Descending">
                <Setter Property="Visibility" TargetName="PART_SortIndicator" Value="Visible" />
                <Setter Property="LayoutTransform" TargetName="PART_SortIndicator">
                    <Setter.Value>
                        <ScaleTransform ScaleX="1" ScaleY="1" />
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </ControlTemplate.Triggers>
        
    </ControlTemplate>

    <Style 
        
        x:Key="{telerik:ThemeResourceKey ThemeType=local:CustomTheme, ElementType=grid:GridViewGroupPanelCell}"
        
        TargetType="grid:GridViewGroupPanelCell">
        <Setter Property="Template" Value="{StaticResource GridViewGroupPanelCellTemplate}" />
    </Style>
    
</ResourceDictionary>