<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:grid="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
	xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
	x:Class="FilteringEx.MainWindow"
	x:Name="Window"
	Title="MainWindow"
	Width="640" Height="480">
	<Window.Resources>
	<SolidColorBrush x:Key="GridViewHeaderCellDropMarkerPenBrush" Color="White" />
    <SolidColorBrush x:Key="GridView_HeaderForeground_Selected" Color="#FF4C607A" />
    <SolidColorBrush x:Key="GridView_HeaderInnerBorder" Color="#FFFCFCFC" />
    <SolidColorBrush x:Key="GridView_HeaderOuterBorder_Over" Color="#FFC0CBD9" />
    <SolidColorBrush x:Key="GridView_HeaderOuterBorder" Color="#FFC0CBD9" />
    <SolidColorBrush x:Key="GridView_HeaderForeground" Color="#FF4C607A" />
    <SolidColorBrush x:Key="GridView_HeaderOuterBorder_Selected" Color="#FFC0CBD9" />
    <SolidColorBrush x:Key="GridView_SortIndicatorColor" Color="#FF4C607A" />
 
    <LinearGradientBrush x:Key="GridView_HighlightedColoumnHeader" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#88FFFFFF" Offset="0"/>
        <GradientStop Color="#880DB02B" Offset="1"/>
    </LinearGradientBrush>
     <telerik:Office_BlueTheme x:Key="Theme"/>
    <grid:GridLineWidthToThicknessConverter x:Key="GridLineWidthToThicknessConverter" />
     
    <Pen x:Key="GridViewHeaderCellDropMarkerPen" Brush="{StaticResource GridViewHeaderCellDropMarkerPenBrush}" Thickness="2" />
     
    <Style x:Key="ColumnHeaderGripperStyle" TargetType="Thumb">
        <Setter Property="Width" Value="8"/>
        <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">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="00:00:00.2000000" To="Normal" />
                        <VisualTransition GeneratedDuration="00:00:00.2000000" To="MouseOver" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="GridViewHeaderCell_Over" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource GridView_HeaderForeground_Selected}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Ascending">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource GridView_HeaderForeground_Selected}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="GridViewHeaderCell_Selected" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Descending">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource GridView_HeaderForeground_Selected}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_SortIndicator" Storyboard.TargetProperty="RenderTransform">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="GridViewHeaderCell_Selected" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="GridViewHeaderCell" Grid.ColumnSpan="2"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}">
                <Border BorderBrush="{StaticResource GridView_HeaderInnerBorder}"
                        Background="{TemplateBinding Background}"
                        BorderThickness="1" />
            </Border>
            <Border x:Name="GridViewHeaderCell_Over" Grid.ColumnSpan="2"
                    Background="{StaticResource GridView_HighlightedColoumnHeader}"
                    BorderBrush="{StaticResource GridView_HeaderOuterBorder_Over}"
                    BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" >
                <Border BorderBrush="Transparent"
                        Background="Transparent"
                        BorderThickness="0" />
            </Border>
            <Border x:Name="GridViewHeaderCell_Selected" Grid.ColumnSpan="2"
                    Background="{StaticResource GridView_HighlightedColoumnHeader}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" >
                <Border BorderBrush="Transparent"
                        Background="Transparent"
                        BorderThickness="0" />
            </Border>
            <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" Grid.ColumnSpan="2"
                  Fill="{StaticResource GridView_SortIndicatorColor}"
                  Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Top"
                  Margin="0,3,0,0"
                  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"                          
                  Width="5" Height="3"
                  RenderTransformOrigin=".5,.5"
                  Opacity="0">
                <Path.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="1" ScaleY="-1"/>
                        <SkewTransform AngleX="0" AngleY="0"/>
                        <RotateTransform Angle="0"/>
                        <TranslateTransform X="0" Y="0"/>
                    </TransformGroup>
                </Path.RenderTransform>
            </Path>
            <grid:FilteringDropDown Name="PART_DistinctFilterControl" Grid.Column="1"
                                    Visibility="{TemplateBinding FilteringUIVisibility}"
                                    telerik:StyleManager.Theme="{StaticResource Theme}"
                                    Margin="0,0,8,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  TargetType="grid:GridViewHeaderCell">
        <Setter Property="Template" Value="{StaticResource GridViewHeaderCellTemplate}" />       
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="#FF6D6D6D" />
        <Setter Property="BorderThickness" Value="0 1 1 2" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="7 0 0 0" />      
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="FontWeight" Value="DemiBold"/>
        <Setter Property="DropMarkPen" Value="{StaticResource GridViewHeaderCellDropMarkerPen}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
    </Style>
 
	</Window.Resources>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}">
		<telerik:RadGridView x:Name="dgDeliveries"
                                 AutoGenerateColumns="False"
                                 AlternateRowBackground="AliceBlue"
                                 AlternationCount="2"
                                 AllowDrop="True"
                                 CanUserSelect="True"
                                 CanUserDeleteRows="False"
                                 CanUserInsertRows="False"
                                 CanUserResizeColumns="True"
                                 EditTriggers="None"
                                 Grid.Row="1"
                                 IsFilteringAllowed="True"
                                 HorizontalGridLinesBrush="SlateGray"
                                 RowIndicatorVisibility="Collapsed"
                                 RowHeight="26"
                                 SelectionMode="Single"
                                 SelectionUnit="FullRow"
                                 ShowColumnFooters="False"
                                 ShowGroupPanel="False"
                                 ShowColumnHeaders="True" telerik:StyleManager.Theme="Office_Blue"
								 ItemsSource="{Binding Collection}"
                                 VerticalGridLinesBrush="Transparent">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn  Header="Requisition" EditTriggers="None" TextAlignment="Left" DataMemberBinding="{Binding Path=RequistionReference}" IsFilterable="False">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Path=RequistionReference}"
                                           VerticalAlignment="Center"
                                           Padding="3,0,3,0"
                                           HorizontalAlignment="Right"
                                           TextAlignment="Right"/>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>
	</Grid>
</Window>