<ResourceDictionary 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"
                    xmlns:spreadsheetControls="clr-namespace:Telerik.Windows.Controls.Spreadsheet.Controls;assembly=Telerik.Windows.Controls.Spreadsheet"
                    xmlns:worksheetMargins="clr-namespace:Telerik.Windows.Controls.Spreadsheet.Worksheets.Margins;assembly=Telerik.Windows.Controls.Spreadsheet"
                    xmlns:appearance="clr-namespace:Office2016InspiredApplication.Appearance">

    <Style x:Key="customRowColumnheadingBaseStyle" TargetType="worksheetMargins:RowColumnHeadingBase" BasedOn="{StaticResource rowColumnheadingBaseStyle}">
        <Setter Property="NormalFillBrush" Value="White"/>
    </Style>

    <Style TargetType="worksheetMargins:RowHeading" BasedOn="{StaticResource customRowColumnheadingBaseStyle}">
        <Setter Property="SelectedFillBrush" Value="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}" />
        <Setter Property="HoverFillBrush" Value="{appearance:Office2016Resource Resource=MouseOverCheckedBorderBrush}" />
    </Style>

    <Style  TargetType="worksheetMargins:ColumnHeading" BasedOn="{StaticResource customRowColumnheadingBaseStyle}">
        <Setter Property="SelectedFillBrush" Value="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}" />
        <Setter Property="HoverFillBrush" Value="{appearance:Office2016Resource Resource=MouseOverCheckedBorderBrush}" />
    </Style>

    <Style  TargetType="spreadsheetControls:SheetSelectorTabItem">
        <Setter Property="DefaultBackground" Value="{telerik:VisualStudio2013Resource ResourceKey=AlternativeBrush}" />
        <Setter Property="UseLayoutRounding" Value="True"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="spreadsheetControls:SheetSelectorTabItem">
                    <Grid x:Name="root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Active">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_TabNameTextBlock" Storyboard.TargetProperty="(TextElement.FontWeight)">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <FontWeight>Bold</FontWeight>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedCellIndicator" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedCellUpperIndicator" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Margin">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Thickness>0 1 -1 0</Thickness>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalBorder" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Separator" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_TabNameTextBlock" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{appearance:Office2016Resource Resource=SelectedSheetForeground}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_TabNameTextBlock" Storyboard.TargetProperty="(TextElement.FontWeight)">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <FontWeight>Normal</FontWeight>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_TabNameTextBlock" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_TabNameTextBox" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Edit">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_TabNameTextBlock" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_TabNameTextBox" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_TabNameTextBox" Storyboard.TargetProperty="(TextElement.FontWeight)">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <FontWeight>Bold</FontWeight>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="10"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="10"/>
                        </Grid.ColumnDefinitions>
                        <Border  x:Name="NormalBorder"
                                         Grid.ColumnSpan="3"
                                         Margin="1"
                                         BorderThickness="0 1 0 0"
                                         Background="{telerik:VisualStudio2013Resource ResourceKey=AlternativeBrush}"
                                         BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=BasicBrush}"/>
                        <Rectangle x:Name="Separator" 
                                           Width="1" 
                                           Margin="0 3" 
                                           VerticalAlignment="Stretch"
                                           HorizontalAlignment="Left" 
                                           Fill="Transparent"/>

                        <Border x:Name="CurrentBackgroundBorder" Grid.ColumnSpan="3" 
                                        Background="{Binding CurrentBackground}"
                                        Margin="2 2 1 1" />

                        <Border x:Name="SelectedBorder"
                                        BorderThickness="1 0 1 1"
                                        Background="White"
                                        Grid.ColumnSpan="3"
                                        Visibility="Collapsed"
                                        BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=BasicBrush}"
                                        IsHitTestVisible="False"/>

                        <Border Background="Transparent" BorderThickness="0 0 0 1" Margin="0 2 0 0" x:Name="PART_BorderCenterOuter" Grid.Column="1">
                            <Grid>
                                <TextBlock x:Name="PART_TabNameTextBlock"
                                                   Text="{Binding Path=SheetName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                   TextAlignment="Center"
                                                   VerticalAlignment="Center"
                                                   HorizontalAlignment="Center"
                                                   FontSize="12"/>

                                <TextBox x:Name="PART_TabNameTextBox"
                                                 Background="{Binding CurrentBackground}"
                                                 Text="{Binding Path=SheetName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                 BorderThickness="0"
                                                 Visibility="Collapsed"
                                                 Height="23"
                                                 VerticalAlignment="Center"
                                                 FontSize="12"
                                                 MaxLength="31"/>

                                <Image x:Name="PART_Image"
                                               VerticalAlignment="Center"
                                               HorizontalAlignment="Right"
                                               Width="16"
                                               Height="16"
                                               UseLayoutRounding="True"
                                               Source="/Telerik.Windows.Controls.Spreadsheet;component/Images/Light/16/newSheet.png"/>
                            </Grid>
                        </Border>
                        <Rectangle x:Name="SelectedCellIndicator"
                                           Grid.ColumnSpan="3"
                                           Visibility="Collapsed"
                                           Height="2"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Bottom"
                                           Fill="{appearance:Office2016Resource Resource=SelectedSheetForeground}"/>
                        <Rectangle x:Name="SelectedCellUpperIndicator"
                                           Grid.ColumnSpan="3"
                                           Margin="0 1 0 0"
                                           Visibility="Collapsed"
                                           Height="1"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Top"
                                           Fill="White"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="spreadsheetControls:RadSpreadsheetStatusBar" BasedOn="{StaticResource RadSpreadsheetStatusBarStyle}">
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="{appearance:Office2016Resource Resource=SliderForeground}"/>
    </Style>

    <Style x:Key="ThumbPredefinedStyle" TargetType="Thumb">
        <Setter Property="BorderBrush" Value="{appearance:Office2016Resource Resource=SliderBackground}"/>
        <Setter Property="Background" Value="{appearance:Office2016Resource Resource=SliderBackground}"/>
        <Setter Property="Width" Value="6"/>
        <Setter Property="Height" Value="14"/>
        <Setter Property="IsTabStop" Value="True"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"/>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="Border" Property="Opacity" Value="0.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderButtonStyle" TargetType="telerik:RadButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:RadButton">
                    <Grid SnapsToDevicePixels="True" Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Content"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <ContentPresenter x:Name="Content"
                                                  TextBlock.Foreground="{TemplateBinding Foreground}"
                                                  Margin="{TemplateBinding Padding}"
                                                  Content="{TemplateBinding Content}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                                  ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                                  RecognizesAccessKey="True" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="spreadsheetControls:ScaleFactorSlider" BasedOn="{StaticResource ScaleFactorSliderStyle}">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{appearance:Office2016Resource Resource=SliderBackground}"/>
        <Setter Property="Foreground" Value="{appearance:Office2016Resource Resource=SliderForeground}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="spreadsheetControls:ScaleFactorSlider">
                    <Grid HorizontalAlignment="Right" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="120"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <telerik:RadButton x:Name="PART_ShowCustomScaleDialogButton"
                                                   Style="{StaticResource SliderButtonStyle}"
                                                   IsTabStop="False"
                                                   Grid.Column="3"
                                                   ContentStringFormat="{}{0}%"
                                                   Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ScaleFactor.Width, Converter={StaticResource doubleToPercentConverter}}"
                                                   Focusable="False"
                                                   Width="46"
                                                   Foreground="{TemplateBinding Foreground}"
                                                   BorderThickness="0"/>
                        <telerik:RadButton x:Name="ScaleOutButton" IsTabStop="False" Grid.Column="0" Width="18" Height="18" BorderThickness="0" Padding="3" Margin="8 0 0 0" Focusable="False" Style="{StaticResource SliderButtonStyle}" VerticalContentAlignment="Center">
                            <Path Data="M461.1,217.7 L469.3,217.7" Stretch="Fill" Stroke="{TemplateBinding Foreground}" StrokeThickness="2" Width="10" Height="2" />
                        </telerik:RadButton>
                        <telerik:RadSlider  x:Name="PART_ScaleSlider" Grid.Column="1"
                                                    Minimum="0"
                                                    Maximum="1"
                                                    VerticalAlignment="Center"
                                                    Background="{TemplateBinding Background}"
                                                    TrackStyle="{StaticResource TrackPredefinedStyle}"
                                                    ThumbStyle="{StaticResource ThumbPredefinedStyle}"/>
                        <telerik:RadButton x:Name="ScaleInButton" Grid.Column="2" IsTabStop="False" Width="18" Height="18" BorderThickness="0" Padding="3" Focusable="False" Style="{StaticResource SliderButtonStyle}">
                            <Path Data="M5,1L5,9 M1,5L9,5" Stretch="None" StrokeThickness="2" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center" />
                        </telerik:RadButton>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>