<Window
	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"
	x:Class="WpfApplication62.MainWindow"
	x:Name="Window"
	Title="MainWindow"
	Width="640" Height="480">
	<Window.Resources>
		<Style TargetType="{x:Type telerik:GridViewGroupRow}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type telerik: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>
							<Border x:Name="ToggleButtonBorder" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" Grid.Column="2" MinHeight="{TemplateBinding MinHeight}" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True">
								<Grid>
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="25"/>
										<ColumnDefinition Width="Auto"/>
										<ColumnDefinition Width="*"/>
									</Grid.ColumnDefinitions>
									<Border Grid.Column="2" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
										<Border.Visibility>
											<Binding Path="ShowHeaderAggregates" RelativeSource="{RelativeSource TemplatedParent}">
												<Binding.Converter>
													<telerik:BooleanToVisibilityConverter/>
												</Binding.Converter>
											</Binding>
										</Border.Visibility>
										<telerik:AggregateResultsList HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="False" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
											<telerik:AggregateResultsList.ItemsPanel>
												<ItemsPanelTemplate>
													<StackPanel IsItemsHost="True" Orientation="Horizontal"/>
												</ItemsPanelTemplate>
											</telerik:AggregateResultsList.ItemsPanel>
											<telerik:AggregateResultsList.ItemTemplate>
												<DataTemplate>
													<telerik:GridViewAggregateResultCell AggregateResult="{Binding}" IsTabStop="False">
														<telerik:StyleManager.Theme>
															<telerik:Office_BlackTheme/>
														</telerik:StyleManager.Theme>
													</telerik:GridViewAggregateResultCell>
												</DataTemplate>
											</telerik:AggregateResultsList.ItemTemplate>
										</telerik:AggregateResultsList>
									</Border>
									<Border x:Name="IconOuterBorder" BorderBrush="#FF848484" BorderThickness="0,0,0,1" Background="Transparent" HorizontalAlignment="Stretch" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
										<Border x:Name="IconInnerBorder" BorderBrush="White" BorderThickness="1,1,0,1">
											<Path x:Name="ExpanderButton" Grid.Column="0" 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" Fill="#FFF30E0E" HorizontalAlignment="Left" Height="5" Margin="{TemplateBinding Padding}" RenderTransformOrigin="0.5,0.5" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="7">
												<Path.RenderTransform>
													<RotateTransform/>
												</Path.RenderTransform>
											</Path>
										</Border>
									</Border>
									<ToggleButton x:Name="HeaderButton" Background="{TemplateBinding Background}" Grid.ColumnSpan="3" Grid.Column="0" IsTabStop="{TemplateBinding IsTabStop}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Opacity="0" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"/>
									<ToggleButton BorderBrush="{x:Null}" BorderThickness="0" Background="Transparent" Grid.Column="1" IsTabStop="{TemplateBinding IsTabStop}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Padding="0,0,10,0" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
										<ToggleButton.Style>
											<Style TargetType="{x:Type ToggleButton}">
												<Setter Property="Template">
													<Setter.Value>
														<ControlTemplate TargetType="{x:Type ToggleButton}">
															<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
																<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}"/>
															</Border>
														</ControlTemplate>
													</Setter.Value>
												</Setter>
												<Setter Property="HorizontalContentAlignment" Value="Left"/>
												<Setter Property="VerticalContentAlignment" Value="Center"/>
												<Setter Property="Padding" Value="9,0,0,0"/>
											</Style>
										</ToggleButton.Style>
										<ContentPresenter ContentTemplate="{TemplateBinding GroupHeaderTemplate}" Content="{TemplateBinding GroupViewModel}" Grid.Column="1" Margin="0,0,10,0" VerticalAlignment="Center"/>
									</ToggleButton>
									<Border BorderBrush="#FF848484" BorderThickness="0,0,0,1" Grid.ColumnSpan="2" Grid.Column="1" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True">
										<Border BorderBrush="White" BorderThickness="0,1,1,1"/>
									</Border>
								</Grid>
							</Border>
							<Border x:Name="PART_IndicatorPresenter" BorderBrush="#FF848484" BorderThickness="0,0,1,1" Grid.Column="0" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}" VerticalAlignment="Stretch" Width="25">
								<Border BorderBrush="White" BorderThickness="1" Background="#FFE4E4E4"/>
							</Border>
							<telerik:IndentPresenter Background="{TemplateBinding Background}" Grid.Column="1" IsTabStop="False" IndentLevel="{TemplateBinding Level}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
								<telerik:StyleManager.Theme>
									<telerik:Office_BlackTheme/>
								</telerik:StyleManager.Theme>
							</telerik:IndentPresenter>
							<Border x:Name="Content" Grid.ColumnSpan="5" Grid.Column="0" Grid.Row="1" Visibility="Collapsed">
								<StackPanel>
									<telerik:GridViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel"/>
									<telerik:GridViewGroupFooterRow x:Name="Footer" IsTabStop="False">
										<telerik:StyleManager.Theme>
											<telerik:Office_BlackTheme/>
										</telerik:StyleManager.Theme>
									</telerik:GridViewGroupFooterRow>
								</StackPanel>
							</Border>
							<Border x:Name="BottomBorder" BorderBrush="#FF848484" BorderThickness="0,0,0,1" Grid.Column="2" Grid.Row="1" Visibility="Collapsed" VerticalAlignment="Bottom"/>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsExpanded" Value="True">
								<Trigger.EnterActions>
									<BeginStoryboard>
										<Storyboard>
											<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="ExpanderButton">
												<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="180"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</BeginStoryboard>
								</Trigger.EnterActions>
								<Trigger.ExitActions>
									<BeginStoryboard>
										<Storyboard>
											<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="ExpanderButton">
												<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</BeginStoryboard>
								</Trigger.ExitActions>
								<Setter Property="Visibility" TargetName="BottomBorder" Value="Visible"/>
								<Setter Property="Visibility" TargetName="Content" Value="Visible"/>
								<Setter Property="BorderThickness" TargetName="IconOuterBorder" Value="0"/>
								<Setter Property="BorderThickness" TargetName="IconInnerBorder" Value="1,1,0,0"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="GroupHeaderTemplate">
				<Setter.Value>
					<DataTemplate>
						<ContentPresenter Content="{Binding Header}"/>
					</DataTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="Background" Value="#FFE4E4E4"/>
			<Setter Property="BorderBrush" Value="#FFCBCBCB"/>
			<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="MinHeight" Value="25"/>
			<Setter Property="SnapsToDevicePixels" Value="True"/>
		</Style>
	</Window.Resources>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}">
		<telerik:RadGridView ItemsSource="{Binding Collection}"/>
		
	</Grid>
</Window>