<ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:c="http://schemas.telerik.com/2008/xaml/compile"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="c"
        xmlns:local="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Pivot"
        xmlns:pivot="clr-namespace:Telerik.Windows.Controls.Pivot;assembly=Telerik.Windows.Controls.Pivot"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <SolidColorBrush x:Key="ControlForeground_Normal" Color="#FF000000"/>
    <SolidColorBrush x:Key="CellsForeground" Color="#FF000000"/>
    <SolidColorBrush x:Key="CellLines" Color="#FFD6E6F7"/>
    <SolidColorBrush x:Key="HeaderCellFill" Color="#FFFFFFFF"/>
    <SolidColorBrush x:Key="SubHeadersFill" Color="#FFF7F9FD"/>
    <SolidColorBrush x:Key="RowSubTotalsFill" Color="#FFFFEBB6"/>
    <SolidColorBrush x:Key="ColumnSubTotalsFill" Color="#FFE1FFD3"/>
    <SolidColorBrush x:Key="GrandTotalsFill" Color="#FFE8EFFC"/>
    <SolidColorBrush x:Key="ControlBackground_Normal" Color="#FFFFFFFF"/>
    <LinearGradientBrush x:Key="ControlBorder_Normal" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFA9BFD6" Offset="0"/>
        <GradientStop Color="#FFCDDAEA" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="ExpandIconBorder" Color="#FFB8D6FB"/>
    <LinearGradientBrush x:Key="ExpandIconBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFFBFCFD"/>
        <GradientStop Color="#FFC6DFFF" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="IconBrush" Color="#FF1E395B"/>
    <SolidColorBrush x:Key="SelectionFill" Color="#7FD9E3F0"/>
    <SolidColorBrush x:Key="SelectionStroke" Color="#FF6CAFFF"/>
    <SolidColorBrush x:Key="SelectionCellFill" Color="#7FD9E3F0"/>
    <SolidColorBrush x:Key="SelectionCellStroke" Color="#FF6CAFFF"/>
    <local:GroupNameConverter x:Key="GroupNameConverter"/>
    <local:LocalizationConverter x:Key="LocalizationConverter"/>
    <Style x:Key="RowGroupTooltipStyle" TargetType="ToolTip">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock FontWeight="Bold" Text="{Binding Data}"/>
                            <TextBlock FontWeight="Bold" Text="(" Margin="4 0 0 0"/>
                            <TextBlock FontWeight="Bold" Text="{Binding GroupDescription.DisplayName}"/>
                            <TextBlock FontWeight="Bold" Text=")"/>
                        </StackPanel>
                        <TextBlock Text="{Binding Data, Converter={StaticResource GroupNameConverter}, ConverterParameter=Pivot_Row}"/>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ColumnGroupTooltipStyle" TargetType="ToolTip">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock FontWeight="Bold" Text="{Binding Data}"/>
                            <TextBlock FontWeight="Bold" Text="(" Margin="4 0 0 0"/>
                            <TextBlock FontWeight="Bold" Text="{Binding GroupDescription.DisplayName}"/>
                            <TextBlock FontWeight="Bold" Text=")"/>
                        </StackPanel>
                        <TextBlock Text="{Binding Data, Converter={StaticResource GroupNameConverter}, ConverterParameter=Pivot_Column}"/>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="CellTooltipStyle" TargetType="ToolTip">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel>
                        <TextBlock TextAlignment="Left" FontWeight="Bold" Text="{Binding AggregateDescription.DisplayName}"/>
                        <TextBlock Text="{Binding Data, Converter={StaticResource LocalizationConverter}, ConverterParameter=Pivot_Value}"/>
                        <TextBlock TextAlignment="Left" Text="{Binding RowItem, Converter={StaticResource GroupNameConverter}, ConverterParameter=Pivot_Row}"/>
                        <TextBlock TextAlignment="Left" Text="{Binding ColumnItem, Converter={StaticResource GroupNameConverter}, ConverterParameter=Pivot_Column}"/>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TableBaseStyle" TargetType="local:TableBase">
        <Setter Property="CellTextAlignment" Value="Right"/>
        <Setter Property="CellTextPadding" Value="4 3"/>
        <Setter Property="RowGroupTooltipStyle" Value="{StaticResource RowGroupTooltipStyle}"/>
        <Setter Property="ColumnGroupTooltipStyle" Value="{StaticResource ColumnGroupTooltipStyle}"/>
        <Setter Property="CellTooltipStyle" Value="{StaticResource CellTooltipStyle}"/>
        <Setter Property="UseLayoutRounding" Value="True"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorder_Normal}"/>
        <Setter Property="Background" Value="{StaticResource ControlBackground_Normal}"/>
        <Setter Property="Foreground" Value="{StaticResource ControlForeground_Normal}"/>
        <Setter Property="QuickStyle">
            <Setter.Value>
                <local:QuickStyle>
                    <local:QuickStyle.HeaderRow>
                        <local:ElementProperties BorderThickness="1" BorderBrush="{StaticResource CellLines}"/>
                    </local:QuickStyle.HeaderRow>
                    <local:QuickStyle.HeaderColumn>
                        <local:ElementProperties BorderThickness="1" BorderBrush="{StaticResource CellLines}"/>
                    </local:QuickStyle.HeaderColumn>
                    <local:QuickStyle.HeaderCell>
                        <local:ElementProperties Background="{StaticResource HeaderCellFill}" BorderThickness="1" BorderBrush="{StaticResource CellLines}"/>
                    </local:QuickStyle.HeaderCell>
                    <local:QuickStyle.RowSubgroups>
                        <local:ElementProperties
                                FontWeight="Bold"
                                Background="{StaticResource SubHeadersFill}"
                                BorderThickness="1"
                                BorderBrush="{StaticResource CellLines}"
                                Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.RowSubgroups>
                    <local:QuickStyle.ColumnSubgroups>
                        <local:ElementProperties
                                FontWeight="Bold"
                                Background="{StaticResource SubHeadersFill}"
                                BorderThickness="1"
                                BorderBrush="{StaticResource CellLines}"
                                Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.ColumnSubgroups>
                    <local:QuickStyle.ColumnFirstAlternationPattern>
                        <local:AlternationElementProperties AlternationCount="1" BorderThickness="1" BorderBrush="{StaticResource CellLines}" Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.ColumnFirstAlternationPattern>
                    <local:QuickStyle.ColumnSecondAlternationPattern>
                        <local:AlternationElementProperties AlternationCount="1" BorderThickness="1" BorderBrush="{StaticResource CellLines}" Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.ColumnSecondAlternationPattern>
                    <local:QuickStyle.RowFirstAlternationPattern>
                        <local:AlternationElementProperties AlternationCount="1" BorderThickness="1" BorderBrush="{StaticResource CellLines}" Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.RowFirstAlternationPattern>
                    <local:QuickStyle.RowSecondAlternationPattern>
                        <local:AlternationElementProperties AlternationCount="1" BorderThickness="1" BorderBrush="{StaticResource CellLines}" Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.RowSecondAlternationPattern>
                    <local:QuickStyle.SubtotalRows>
                        <local:ElementProperties
                                FontWeight="Bold"
                                BorderThickness="1"
                                BorderBrush="{StaticResource CellLines}"
                                Background="{StaticResource RowSubTotalsFill}"
                                Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.SubtotalRows>
                    <local:QuickStyle.SubtotalColumns>
                        <local:ElementProperties
                                FontWeight="Bold"
                                BorderThickness="1"
                                BorderBrush="{StaticResource CellLines}"
                                Background="{StaticResource ColumnSubTotalsFill}"
                                Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.SubtotalColumns>
                    <local:QuickStyle.GrandTotalRow>
                        <local:ElementProperties
                                FontWeight="Bold"
                                Background="{StaticResource GrandTotalsFill}"
                                BorderThickness="1"
                                BorderBrush="{StaticResource CellLines}"
                                Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.GrandTotalRow>
                    <local:QuickStyle.GrandTotalColumn>
                        <local:ElementProperties
                                FontWeight="Bold"
                                Background="{StaticResource GrandTotalsFill}"
                                BorderThickness="1"
                                BorderBrush="{StaticResource CellLines}"
                                Foreground="{StaticResource CellsForeground}"/>
                    </local:QuickStyle.GrandTotalColumn>
                </local:QuickStyle>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TableBase">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <local:TableRootPanel x:Name="PART_TableRoot">
                            <pivot:PivotDecoratorPanel x:Name="PART_DecoratorsHost"/>
                            <pivot:SelectionOverlay x:Name="PART_Selection"/>
                            <pivot:PivotGridPanel x:Name="PART_ColumnsHost"/>
                            <pivot:PivotGridPanel x:Name="PART_RowsHost"/>
                            <pivot:PivotCellsPanel x:Name="PART_CellsHost"/>
                            <pivot:ScrollBarPanel Orientation="Horizontal">
                                <ScrollBar x:Name="PART_HorizontalScrollBar" Orientation="Horizontal"/>
                            </pivot:ScrollBarPanel>
                            <pivot:ScrollBarPanel Orientation="Vertical">
                                <ScrollBar x:Name="PART_VerticalScrollBar" Orientation="Vertical"/>
                            </pivot:ScrollBarPanel>
                        </local:TableRootPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <pivot:PivotCellTemplateSelector x:Key="CellTemplateSelector">
        <pivot:PivotCellTemplateSelector.Negative>
            <DataTemplate>
                <Path x:Name="Negative"
                        Data="M7,0.5 L0.5,7 7,13.5 13.5,7 Z"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Margin="2"
                        Width="14"
                        Height="14"
                        Fill="Red"
                        Stroke="DarkRed"
                        StrokeThickness="1"/>
            </DataTemplate>
        </pivot:PivotCellTemplateSelector.Negative>
        <pivot:PivotCellTemplateSelector.Neutral>
            <DataTemplate>
                <Path x:Name="Neutral"
                        Data="M0.5,13.5 L13.5,13.5 7,1.5 Z"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Margin="2"
                        Width="14"
                        Height="14"
                        Fill="DarkGray"
                        Stroke="Gray"
                        StrokeThickness="1"/>
            </DataTemplate>
        </pivot:PivotCellTemplateSelector.Neutral>
        <pivot:PivotCellTemplateSelector.Positive>
            <DataTemplate>
                <Ellipse x:Name="Positive" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3" Width="12" Height="12" Fill="Green" Stroke="DarkGreen" StrokeThickness="1"/>
            </DataTemplate>
        </pivot:PivotCellTemplateSelector.Positive>
    </pivot:PivotCellTemplateSelector>
    <Style x:Key="SelectionOverlayStyle" TargetType="pivot:SelectionOverlay">
        <Setter Property="SelectionFill" Value="{StaticResource SelectionFill}"/>
        <Setter Property="SelectionStroke" Value="{StaticResource SelectionStroke}"/>
        <Setter Property="SelectionStrokeThickness" Value="1"/>
        <Setter Property="SelectionPadding" Value="0"/>
        <Setter Property="SelectionCellFill" Value="{StaticResource SelectionCellFill}"/>
        <Setter Property="SelectionCellStroke" Value="{StaticResource SelectionCellStroke}"/>
        <Setter Property="SelectionCellPadding" Value="0"/>
        <Setter Property="SelectionCellStrokeThickness" Value="1"/>
        <Setter Property="DrawSelectionCell" Value="True"/>
    </Style>
    <Style x:Key="PivotGridStyle" TargetType="local:RadPivotGrid" BasedOn="{StaticResource TableBaseStyle}">
        <Setter Property="CellTemplateSelector" Value="{StaticResource CellTemplateSelector}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadPivotGrid">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <telerik:RadBusyIndicator IsBusy="{TemplateBinding Property=IsBusy}">
                            <local:TableRootPanel x:Name="PART_TableRoot">
                                <pivot:PivotDecoratorPanel x:Name="PART_DecoratorsHost"/>
                                <pivot:SelectionOverlay x:Name="PART_Selection"/>
                                <pivot:PivotGridPanel x:Name="PART_ColumnsHost"/>
                                <pivot:PivotGridPanel x:Name="PART_RowsHost"/>
                                <pivot:PivotCellsPanel x:Name="PART_CellsHost"/>
                                <pivot:ScrollBarPanel Orientation="Horizontal">
                                    <ScrollBar x:Name="PART_HorizontalScrollBar" Orientation="Horizontal"/>
                                </pivot:ScrollBarPanel>
                                <pivot:ScrollBarPanel Orientation="Vertical">
                                    <ScrollBar x:Name="PART_VerticalScrollBar" Orientation="Vertical"/>
                                </pivot:ScrollBarPanel>
                            </local:TableRootPanel>
                        </telerik:RadBusyIndicator>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="PivotHeaderStyle" TargetType="local:PivotHeader">
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="4 3 4 3"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="DataTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding Data}" TextWrapping="Wrap"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:PivotHeader">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <ContentPresenter
                                Margin="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Content="{Binding}"
                                ContentTemplate="{TemplateBinding DataTemplate}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="PivotGroupHeaderStyle" TargetType="local:PivotGroupHeader">
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="DataTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding Data}" TextWrapping="Wrap"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:PivotGroupHeader">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ExpandStates">
                                <VisualState x:Name="Expanded"/>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CollapseIcon" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandIcon" Storyboard.TargetProperty="(FrameworkElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid x:Name="PART_ExpandIcon" Width="21" Height="21" HorizontalAlignment="Left" VerticalAlignment="Top" Background="Transparent" Margin="1 1 0 0">
                                <Rectangle Margin="6" Fill="{StaticResource ExpandIconBackground}" Stroke="{StaticResource ExpandIconBorder}"/>
                                <Path x:Name="CollapseIcon" Margin="6" Data="M2,4.5 L7,4.5" Stretch="None" Stroke="{StaticResource IconBrush}" StrokeThickness="1"/>
                                <Path x:Name="ExpandIcon" Margin="6" Data="M2,4.5 L7,4.5 M4.5,2 L4.5,7" Stretch="None" Stroke="{StaticResource IconBrush}" StrokeThickness="1" Visibility="Collapsed"/>
                            </Grid>
                            <ContentPresenter Grid.Column="1" Margin="0 3 4 0" Content="{Binding}" ContentTemplate="{TemplateBinding DataTemplate}"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TreeGridStyle" TargetType="pivot:TreeGrid" BasedOn="{StaticResource TableBaseStyle}">
        <Setter Property="RowToolTipIsEnabled" Value="False"/>
        <Setter Property="ColumnToolTipIsEnabled" Value="False"/>
        <Setter Property="CellToolTipIsEnabled" Value="False"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="pivot:TreeGrid">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
                        <local:TableRootPanel x:Name="PART_TableRoot" Margin="1">
                            <pivot:PivotDecoratorPanel x:Name="PART_DecoratorsHost"/>
                            <pivot:PivotGridPanel x:Name="PART_RowsHost"/>
                            <pivot:ScrollBarPanel Orientation="Horizontal">
                                <ScrollBar x:Name="PART_HorizontalScrollBar" Orientation="Horizontal"/>
                            </pivot:ScrollBarPanel>
                            <pivot:ScrollBarPanel Orientation="Vertical">
                                <ScrollBar x:Name="PART_VerticalScrollBar" Orientation="Vertical"/>
                            </pivot:ScrollBarPanel>
                        </local:TableRootPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TreeGridRowHeaderStyle" TargetType="pivot:TreeGridRowHeader" BasedOn="{StaticResource PivotHeaderStyle}"/>
    <Style x:Key="TreeGridRowGroupHeaderStyle" TargetType="pivot:TreeGridRowGroupHeader" BasedOn="{StaticResource PivotGroupHeaderStyle}"/>
    <Style TargetType="local:RadPivotGrid" BasedOn="{StaticResource PivotGridStyle}"/>
    <Style TargetType="local:PivotHeader" BasedOn="{StaticResource PivotHeaderStyle}"/>
    <Style TargetType="local:PivotGroupHeader" BasedOn="{StaticResource PivotGroupHeaderStyle}"/>
    <Style TargetType="pivot:SelectionOverlay" BasedOn="{StaticResource SelectionOverlayStyle}"/>
    <Style TargetType="pivot:TreeGrid" BasedOn="{StaticResource TreeGridStyle}"/>
    <Style TargetType="pivot:TreeGridRowHeader" BasedOn="{StaticResource TreeGridRowHeaderStyle}"/>
    <Style TargetType="pivot:TreeGridRowGroupHeader" BasedOn="{StaticResource TreeGridRowGroupHeaderStyle}"/>
</ResourceDictionary>
