<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:theming="using:Telerik.UI.Xaml.Controls"
    xmlns:local="using:Telerik.UI.Xaml.Controls.Input"
    xmlns:localCalendar="using:Telerik.UI.Xaml.Controls.Input.Calendar">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary>
            <ResourceDictionary.ThemeDictionaries>
                <ResourceDictionary x:Key="Dark" Source="ms-appx:///Telerik.UI.Xaml.Input.UWP/Themes/ThemeResourcesDark.xaml"/>
                <ResourceDictionary x:Key="Light" Source="ms-appx:///Telerik.UI.Xaml.Input.UWP/Themes/ThemeResourcesLight.xaml"/>
                <ResourceDictionary x:Key="HighContrast" Source="ms-appx:///Telerik.UI.Xaml.Input.UWP/Themes/ThemeResourcesHighContrast.xaml"/>
            </ResourceDictionary.ThemeDictionaries>
        </ResourceDictionary>

        <ResourceDictionary>
            <theming:UserThemeResources x:Key="ResourceLoaderInitializer"/>
            <ResourceDictionary.ThemeDictionaries>
                <ResourceDictionary x:Key="Dark" Source="{CustomResource DarkResourcesPath}"/>
                <ResourceDictionary x:Key="Light" Source="{CustomResource LightResourcesPath}"/>
                <ResourceDictionary x:Key="HighContrast" Source="{CustomResource HighContrastResourcesPath}"/>
            </ResourceDictionary.ThemeDictionaries>
        </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="localCalendar:AppointmentControl">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="IndicatorColor" Value="{StaticResource TelerikCalendarPreviousNextButtonForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:AppointmentControl">
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <TextBlock FontFamily="Segoe UI Symbol"
                                   Text="&#xE012;"
                                   FontSize="15"
                                   TextWrapping="Wrap"
                                   TextAlignment="Left"
                                   Foreground="{TemplateBinding IndicatorColor}"
                                   Padding="4, 4, 0, 0"
                                   Visibility="{TemplateBinding LeftIndicatorVisibility}"/>
                        <TextBlock Grid.Column="1"
                                   FontFamily="Segoe UI Symbol"
                                   Text="&#xE013;"
                                   FontSize="15"
                                   TextWrapping="Wrap"
                                   TextAlignment="Right"
                                   Foreground="{TemplateBinding IndicatorColor}"
                                   Padding="0, 4, 4, 0"
                                   Visibility="{TemplateBinding RightIndicatorVisibility}"/>
                        <ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
                                          Content="{TemplateBinding Header}" 
                                          ContentTemplate="{TemplateBinding HeaderTemplate}"
                                          Style="{TemplateBinding HeaderStyle}"
                                          TextWrapping="Wrap"
                                          Margin="5, 0, 0, 0"/>
                        <ContentPresenter Grid.Row="2" Grid.ColumnSpan="2"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          TextWrapping="Wrap"
                                          Margin="5, 0, 0, 0"/>
                        
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localCalendar:SlotControl">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="{x:Null}"/>
        <Setter Property="Canvas.ZIndex" Value="250"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:SlotControl">
                    <ContentPresenter Content="{TemplateBinding Content}"
                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                      BorderBrush="{TemplateBinding BorderBrush}"
                                      BorderThickness="{TemplateBinding BorderThickness}"
                                      Background="{TemplateBinding Background}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CalendarLeftArrowButtonStyle" TargetType="Button">
        <Setter Property="Foreground" Value="{ThemeResource TelerikCalendarPreviousNextButtonForegroundBrush}" />
        <Setter Property="FontSize" Value="18" />
        <Setter Property="FontFamily" Value="Segoe UI Symbol" />
        <Setter Property="AutomationProperties.Name" Value="CalendarLeftArrowButton"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="Transparent"  >
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ArrowGlyph">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TelerikCalendarPreviousNextButtonPointerPressedForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ArrowGlyph">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TelerikCalendarPreviousNextButtonDisabledForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused"/>
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="PointerFocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <TextBlock x:Name="ArrowGlyph" Text="{TemplateBinding Content}" Margin="15, 14, 15, 14" AutomationProperties.AccessibilityView="Raw"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CalendarRightArrowButtonStyle" TargetType="Button">
        <Setter Property="Foreground" Value="{ThemeResource TelerikCalendarPreviousNextButtonForegroundBrush}" />
        <Setter Property="FontSize" Value="18" />
        <Setter Property="AutomationProperties.Name" Value="CalendarRightArrowButton"/>
        <Setter Property="FontFamily" Value="Segoe UI Symbol" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="Transparent" >
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ArrowGlyph">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TelerikCalendarPreviousNextButtonPointerOverForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ArrowGlyph">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TelerikCalendarPreviousNextButtonPointerPressedForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ArrowGlyph">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TelerikCalendarPreviousNextButtonDisabledForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused"/>
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="PointerFocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <TextBlock x:Name="ArrowGlyph" Text="{TemplateBinding Content}" Margin="15, 14, 15, 14" AutomationProperties.AccessibilityView="Raw"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localCalendar:CalendarNavigationControl">
        <Setter Property="Height" Value="50"/>
        <Setter Property="Foreground" Value="{ThemeResource TelerikCalendarHeaderButtonForegroundBrush}" />
        <Setter Property="FontFamily" Value="Segoe UI Light"/>
        <Setter Property="FontWeight" Value="Light"/>
        <Setter Property="FontSize" Value="24"/>
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Padding" Value="15 0" />
        <Setter Property="BorderThickness" Value="0 0 0 1" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:CalendarNavigationControl">
                    <Border Style="{TemplateBinding NavigationControlBorderStyle}" BorderThickness="{TemplateBinding BorderThickness}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="navigateToViewLevelContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TelerikCalendarHeaderButtonPointerPressedForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Released"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="navigateToViewLevelContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TelerikCalendarHeaderButtonDisabledForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Button x:Name="navigateToPreviousViewButton" Visibility="{TemplateBinding NavigationArrowsVisibility}"
                                    Style="{StaticResource CalendarLeftArrowButtonStyle}" Grid.Column="0" MinWidth="50"/>
                            <ContentPresenter x:Name="navigateToViewLevelContentPresenter"
                                              Grid.Column="1"
                                              Foreground="{TemplateBinding Foreground}"
                                              FontWeight="{TemplateBinding FontWeight}" 
                                              FontFamily="{TemplateBinding FontFamily}"
                                              FontSize="{TemplateBinding FontSize}"
                                              FontStyle="{TemplateBinding FontStyle}"
                                              Margin="{TemplateBinding Padding}"
                                              Content="{TemplateBinding HeaderContent}"
                                              ContentTemplate="{TemplateBinding HeaderContentTemplate}"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Center"/>
                            <Button x:Name="navigateToNextViewButton" Visibility="{TemplateBinding NavigationArrowsVisibility}" 
                                    Style="{StaticResource CalendarRightArrowButtonStyle}"  Grid.Column="2" MinWidth="50" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localCalendar:CalendarHoldClueControl">
        <Setter Property="Background" Value="{ThemeResource TelerikCalendarHoldClueControlBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:CalendarHoldClueControl">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Rectangle Grid.Row="1" Width="3" Fill="{TemplateBinding Background}" />
                        <Ellipse Grid.RowSpan="2" Width="{TemplateBinding Width}" Height="{TemplateBinding Width}" Margin="0,10,0,0" 
                                 Fill="{TemplateBinding Background}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="Button" x:Key="CalendarFooterControlButtonStyle">
        <Setter Property="MinWidth" Value="47"/>
        <Setter Property="Content" Value="+"/>
        <Setter Property="HorizontalAlignment" Value="Right"/>
        <Setter Property="AutomationProperties.Name" Value="CalendarFooterControlButton"/>
        <Setter Property="FontSize" Value="24"/>
        <Setter Property="Foreground" Value="{ThemeResource TelerikCalendarFooterButtonForegroundBrush}" />
        <Setter Property="Background" Value="{ThemeResource TelerikCalendarFooterButtonBackgroundBrush}" />
    </Style>

    <Style TargetType="localCalendar:CalendarFooterControl" x:Key="CalendarFooterControlStyle">
        <Setter Property="ButtonStyle" Value="{StaticResource CalendarFooterControlButtonStyle}"/>
        <Setter Property="MinHeight" Value="48"/>
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Background" Value="{ThemeResource TelerikCalendarFooterControlBackgroundBrush}" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:CalendarFooterControl">
                    <Grid x:Name="calendarFooterPanel"
                          Background="{TemplateBinding Background}">
                        <Button x:Name="calendarFooterButton"
                                Style="{TemplateBinding ButtonStyle}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="localCalendar:CalendarFooterControl" BasedOn="{StaticResource CalendarFooterControlStyle}"/>
    
    <Style TargetType="local:RadCalendar">
        <Setter Property="UseSystemFocusVisuals" Value="True" />
        <Setter Property="MinHeight" Value="200" />
        <Setter Property="MinWidth" Value="200" />
        <Setter Property="Background" Value="{ThemeResource TelerikCalendarBackgroundBrush}"/>
        <Setter Property="GridLinesBrush" Value="{ThemeResource TelerikCalendarGridLinesBrush}" />
        <Setter Property="BorderBrush" Value="{ThemeResource TelerikCalendarGridLinesBrush}" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="WeekNumberCellStyle">
            <Setter.Value>
                <local:CalendarCellStyle>
                    <local:CalendarCellStyle.ContentStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="Margin" Value="7,0,4,4" />
                            <Setter Property="FontSize" Value="13.333" />
                            <Setter Property="Foreground" Value="{ThemeResource TelerikCalendarDayNamesForegroundBrush}" />
                            <Setter Property="TextAlignment" Value="Center" />
                            <Setter Property="VerticalAlignment" Value="Bottom" />
                        </Style>
                    </local:CalendarCellStyle.ContentStyle>
                </local:CalendarCellStyle>
            </Setter.Value>
        </Setter>
        <Setter Property="PointerOverCellStyle">
            <Setter.Value>
                <local:CalendarCellStyle>
                    <local:CalendarCellStyle.DecorationStyle>
                        <Style TargetType="Border">
                            <Setter Property="Background" Value="{ThemeResource TelerikCalendarPointerOverBackgroundBrush}" />
                            <Setter Property="BorderBrush" Value="{ThemeResource TelerikCalendarPointerOverBorderBrush}"/>
                        </Style>
                    </local:CalendarCellStyle.DecorationStyle>
                </local:CalendarCellStyle>
            </Setter.Value>
        </Setter>
        <Setter Property="CurrentCellStyle">
            <Setter.Value>
                <local:CalendarCellStyle>
                    <local:CalendarCellStyle.DecorationStyle>
                        <Style TargetType="Border">
                            <Setter Property="BorderBrush" Value="{ThemeResource TelerikCalendarCurrentCellBorderBrush}" />
                        </Style>
                    </local:CalendarCellStyle.DecorationStyle>
                </local:CalendarCellStyle>
            </Setter.Value>
        </Setter>
        <Setter Property="SelectedCellStyle">
            <Setter.Value>
                <local:CalendarCellStyle>
                    <local:CalendarCellStyle.ContentStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="Foreground" Value="{ThemeResource TelerikCalendarSelectedCellForegroundBrush}" />
                            <Setter Property="FontSize" Value="13.333" />
                            <Setter Property="VerticalAlignment" Value="Bottom" />
                            <Setter Property="Margin" Value="6,0,0,4" />
                        </Style>
                    </local:CalendarCellStyle.ContentStyle>
                    <local:CalendarCellStyle.DecorationStyle>
                        <Style TargetType="Border">
                            <Setter Property="BorderBrush" Value="{ThemeResource TelerikCalendarSelectedCellBorderBrush}" />
                            <Setter Property="Background" Value="{ThemeResource TelerikCalendarSelectedCellBackgroundBrush}" />
                        </Style>
                    </local:CalendarCellStyle.DecorationStyle>
                </local:CalendarCellStyle>
            </Setter.Value>
        </Setter>
        <Setter Property="NavigationControlBorderStyle">
            <Setter.Value>
                <Style TargetType="Border">
                    <Setter Property="BorderBrush" Value="{ThemeResource TelerikCalendarGridLinesBrush}"/>
                    <Setter Property="Background" Value="{ThemeResource TelerikCalendarNavigationControlBackgroundBrush}"/>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadCalendar">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid Margin="{TemplateBinding Padding}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition/>
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <localCalendar:CalendarNavigationControl x:Name="navigationControl"
                                                                     Visibility="{TemplateBinding HeaderVisibility}"
                                                                     NavigationArrowsVisibility="{TemplateBinding NavigationArrowsVisibility}"
                                                                     NavigationControlBorderStyle="{TemplateBinding NavigationControlBorderStyle}">
                            </localCalendar:CalendarNavigationControl>
                            <localCalendar:CalendarViewHost x:Name="PART_CalendarViewHost"
                                                            Grid.Row="1"
                                                            Background="{TemplateBinding Background}"
                                                            RenderTransformOrigin="0.5,0.5">
                                <Canvas.RenderTransform>
                                    <ScaleTransform />
                                </Canvas.RenderTransform>
                            </localCalendar:CalendarViewHost>

                            <localCalendar:CalendarFooterControl x:Name="PART_FooterControl"
                                                                 Grid.Row="2"
                                                                 Canvas.ZIndex="-1"
                                                                 Visibility="{TemplateBinding FooterVisibility}"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>

