<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="MahApps.Metro.Styles.MetroCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
        <Setter Property="FontFamily" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}, Path=FontFamily, Mode=OneWay}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}, Path=FontSize, Mode=OneWay}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="MinHeight" Value="5" />
        <Setter Property="MinWidth" Value="5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CalendarDayButton}">
                    <Grid>
                        <Rectangle x:Name="TodayBackground"
                                   Fill="{DynamicResource AccentColorBrush}"
                                   Opacity="0" />
                        <Rectangle x:Name="SelectedBackground"
                                   Fill="{DynamicResource AccentColorBrush4}"
                                   Opacity="0" />
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" />
                        <Rectangle x:Name="HighlightBackground"
                                   Fill="{DynamicResource AccentColorBrush4}"
                                   Opacity="0" />
                        <Path x:Name="Blackout"
                              Margin="3"
                              HorizontalAlignment="Stretch"
                              VerticalAlignment="Stretch"
                              Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z"
                              Fill="{DynamicResource AccentColorBrush3}"
                              Opacity="0"
                              RenderTransformOrigin="0.5,0.5"
                              Stretch="Fill" />
                        <ContentPresenter x:Name="NormalText"
                                          Margin="5 1 5 1"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          TextElement.Foreground="{TemplateBinding Foreground}" />
                        <Rectangle x:Name="DayButtonFocusVisual"
                                   IsHitTestVisible="false"
                                   Stroke="{DynamicResource AccentColorBrush3}"
                                   Visibility="Collapsed" />
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HighlightBackground"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.75"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HighlightBackground"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.9"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HighlightBackground"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0"
                                                         Duration="0" />
                                        <DoubleAnimation Storyboard.TargetName="NormalText"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To=".35"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ActiveStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Active" />
                                <VisualState x:Name="Inactive">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalText"
                                                                       Storyboard.TargetProperty="(TextElement.Foreground)"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame Value="{DynamicResource GrayBrush2}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="BlackoutDayStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="NormalDay" />
                                <VisualState x:Name="BlackoutDay">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Blackout"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="DayButtonFocusVisual" Property="Visibility" Value="Visible" />
                            <Setter TargetName="NormalText" Property="TextElement.Foreground" Value="{DynamicResource AccentColorBrush}" />
                        </Trigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}, Path=IsTodayHighlighted}" Value="True" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsToday}" Value="True" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="DayButtonFocusVisual" Property="Stroke" Value="{DynamicResource GrayBrush1}" />
                            <Setter TargetName="DayButtonFocusVisual" Property="Visibility" Value="Visible" />
                            <Setter TargetName="NormalText" Property="TextElement.Foreground" Value="{DynamicResource AccentColorBrush}" />
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}, Path=IsTodayHighlighted}" Value="True" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsToday}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="NormalText" Property="TextElement.Foreground" Value="{DynamicResource AccentSelectedColorBrush}" />
                            <Setter TargetName="TodayBackground" Property="Opacity" Value="1" />
                        </MultiDataTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsToday" Value="True" />
                                <Condition Property="IsBlackedOut" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Blackout" Property="Fill" Value="{DynamicResource AccentColorBrush}" />
                            <Setter TargetName="TodayBackground" Property="Opacity" Value="0.5" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalContentAlignment" Value="Center" />
    </Style>

    <!--  obsolete  -->
    <Style x:Key="MetroCalendarDayButtonStyle"
           BasedOn="{StaticResource MahApps.Metro.Styles.MetroCalendarDayButtonStyle}"
           TargetType="{x:Type CalendarDayButton}" />

    <Style x:Key="MahApps.Metro.Styles.MetroCalendarItemStyle" TargetType="{x:Type CalendarItem}">
        <Setter Property="Margin" Value="0 3" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CalendarItem}">
                    <ControlTemplate.Resources>
                        <!--  Used for day names  -->
                        <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
                            <TextBlock Margin="0 6 0 6"
                                       HorizontalAlignment="Center"
                                       VerticalAlignment="Center"
                                       FontWeight="Bold"
                                       Foreground="{DynamicResource BlackBrush}"
                                       Opacity="0.8"
                                       Text="{Binding}" />
                        </DataTemplate>
                    </ControlTemplate.Resources>
                    <Grid x:Name="PART_Root">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <Grid Margin="{TemplateBinding Padding}">
                                <Grid.Resources>
                                    <ControlTemplate x:Key="PreviousButtonTemplate" TargetType="{x:Type Button}">
                                        <Grid Cursor="Hand">
                                            <Rectangle Fill="{DynamicResource AccentColorBrush}"
                                                       Opacity="0.1"
                                                       Stretch="Fill" />
                                            <Path x:Name="path"
                                                  Width="6"
                                                  Height="10"
                                                  Margin="14 -6 0 0"
                                                  HorizontalAlignment="Left"
                                                  VerticalAlignment="Center"
                                                  Data="M288.75,232.25 L288.75,240.625 L283,236.625 z"
                                                  Fill="white"
                                                  Opacity="0.7"
                                                  Stretch="Fill" />
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualState x:Name="Normal" />
                                                    <VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetName="path"
                                                                             Storyboard.TargetProperty="Opacity"
                                                                             To="1"
                                                                             Duration="0" />
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Disabled">
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetName="path"
                                                                             Storyboard.TargetProperty="Opacity"
                                                                             To=".5"
                                                                             Duration="0" />
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                        </Grid>
                                    </ControlTemplate>
                                    <ControlTemplate x:Key="NextButtonTemplate" TargetType="{x:Type Button}">
                                        <Grid Cursor="Hand">
                                            <Rectangle Fill="{DynamicResource AccentColorBrush}"
                                                       Opacity="0.1"
                                                       Stretch="Fill" />
                                            <Path x:Name="path"
                                                  Width="6"
                                                  Height="10"
                                                  Margin="0 -6 14 0"
                                                  HorizontalAlignment="Right"
                                                  VerticalAlignment="Center"
                                                  Data="M282.875,231.875 L282.875,240.375 L288.625,236 z"
                                                  Fill="white"
                                                  Opacity="0.7"
                                                  Stretch="Fill" />
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualState x:Name="Normal" />
                                                    <VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetName="path"
                                                                             Storyboard.TargetProperty="Opacity"
                                                                             To="1"
                                                                             Duration="0" />
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Disabled">
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetName="path"
                                                                             Storyboard.TargetProperty="Opacity"
                                                                             To=".2"
                                                                             Duration="0" />
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                        </Grid>
                                    </ControlTemplate>
                                    <ControlTemplate x:Key="HeaderButtonTemplate" TargetType="{x:Type Button}">
                                        <Grid Cursor="Hand">
                                            <ContentPresenter x:Name="buttonContent"
                                                              Margin="1 4 1 9"
                                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                              Content="{TemplateBinding Content}"
                                                              ContentTemplate="{TemplateBinding ContentTemplate}"
                                                              Opacity="0.7" />
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualState x:Name="Normal" />
                                                    <VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetName="buttonContent"
                                                                             Storyboard.TargetProperty="Opacity"
                                                                             To="1"
                                                                             Duration="0" />
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Disabled">
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetName="buttonContent"
                                                                             Storyboard.TargetProperty="Opacity"
                                                                             To=".5"
                                                                             Duration="0" />
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                        </Grid>
                                    </ControlTemplate>

                                    <Style x:Key="PreviousCalendarButtonStyle" TargetType="{x:Type Button}">
                                        <Setter Property="Template" Value="{StaticResource PreviousButtonTemplate}" />
                                    </Style>
                                    <Style x:Key="NextCalendarButtonStyle" TargetType="{x:Type Button}">
                                        <Setter Property="Template" Value="{StaticResource NextButtonTemplate}" />
                                    </Style>
                                    <Style x:Key="HeaderCalendarButtonStyle" TargetType="{x:Type Button}">
                                        <Setter Property="Template" Value="{StaticResource HeaderButtonTemplate}" />
                                    </Style>
                                </Grid.Resources>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>

                                <Grid Grid.Row="0"
                                      HorizontalAlignment="Stretch"
                                      Background="{DynamicResource AccentColorBrush}">
                                    <Button x:Name="PART_HeaderButton"
                                            Grid.Row="0"
                                            HorizontalAlignment="Center"
                                            VerticalAlignment="Center"
                                            Focusable="False"
                                            FontWeight="Bold"
                                            Style="{StaticResource HeaderCalendarButtonStyle}" />
                                    <Button x:Name="PART_PreviousButton"
                                            Grid.Row="0"
                                            Width="28"
                                            Height="20"
                                            HorizontalAlignment="Left"
                                            Focusable="False"
                                            Style="{StaticResource PreviousCalendarButtonStyle}" />
                                    <Button x:Name="PART_NextButton"
                                            Grid.Row="0"
                                            Width="28"
                                            Height="20"
                                            HorizontalAlignment="Right"
                                            Focusable="False"
                                            Style="{StaticResource NextCalendarButtonStyle}" />
                                </Grid>
                                <Grid x:Name="PART_MonthView"
                                      Grid.Row="1"
                                      Margin="6 -1 6 6"
                                      HorizontalAlignment="Stretch"
                                      VerticalAlignment="Stretch"
                                      Visibility="Visible">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                </Grid>
                                <Grid x:Name="PART_YearView"
                                      Grid.Row="1"
                                      Margin="6 -3 7 6"
                                      HorizontalAlignment="Stretch"
                                      VerticalAlignment="Stretch"
                                      Visibility="Hidden">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                </Grid>
                            </Grid>
                        </Border>
                        <Rectangle x:Name="PART_DisabledVisual"
                                   Fill="{DynamicResource ControlsDisabledBrush}"
                                   Opacity="0"
                                   Stretch="Fill"
                                   Stroke="{DynamicResource ControlsDisabledBrush}"
                                   StrokeThickness="1"
                                   Visibility="Collapsed" />
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PART_DisabledVisual"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="PART_DisabledVisual" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Year">
                            <Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
                            <Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade">
                            <Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
                            <Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  obsolete  -->
    <Style x:Key="MetroCalendarItemStyle"
           BasedOn="{StaticResource MahApps.Metro.Styles.MetroCalendarItemStyle}"
           TargetType="{x:Type CalendarItem}" />

    <!--  Style for Month and Year buttons  -->
    <Style x:Key="MahApps.Metro.Styles.MetroCalendarButtonStyle" TargetType="{x:Type CalendarButton}">
        <Setter Property="Background" Value="{DynamicResource AccentColorBrush4}" />
        <Setter Property="FontFamily" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}, Path=FontFamily, Mode=OneWay}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}, Path=FontSize, Mode=OneWay}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="MinHeight" Value="42" />
        <Setter Property="MinWidth" Value="40" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CalendarButton}">
                    <Grid>
                        <Rectangle x:Name="SelectedBackground"
                                   Fill="{TemplateBinding Background}"
                                   Opacity="0" />
                        <Rectangle x:Name="Background"
                                   Fill="{TemplateBinding Background}"
                                   Opacity="0" />
                        <ContentPresenter x:Name="NormalText"
                                          Margin="1 0 1 1"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          TextElement.Foreground="{TemplateBinding Foreground}" />
                        <Rectangle x:Name="CalendarButtonFocusVisual"
                                   IsHitTestVisible="false"
                                   Stroke="{DynamicResource AccentColorBrush3}"
                                   Visibility="Collapsed" />
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Background"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To=".5"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Background"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To=".5"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectedBackground"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To=".75"
                                                         Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ActiveStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Active" />
                                <VisualState x:Name="Inactive">
                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalText"
                                                                       Storyboard.TargetProperty="(TextElement.Foreground)"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame Value="{DynamicResource GrayBrush2}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CalendarButtonFocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="CalendarButtonFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CalendarButtonFocusVisual"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="CalendarButtonUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CalendarButtonFocusVisual"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="CalendarButtonFocusVisual" Property="Visibility" Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalContentAlignment" Value="Center" />
    </Style>

    <!--  obsolete  -->
    <Style x:Key="MetroCalendarButtonStyle"
           BasedOn="{StaticResource MahApps.Metro.Styles.MetroCalendarButtonStyle}"
           TargetType="{x:Type CalendarButton}" />

    <Style x:Key="MahApps.Metro.Styles.BaseMetroCalendar" TargetType="{x:Type Calendar}">
        <Setter Property="Background" Value="{DynamicResource WhiteBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource BlackBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="CalendarButtonStyle" Value="{DynamicResource MahApps.Metro.Styles.MetroCalendarButtonStyle}" />
        <Setter Property="CalendarDayButtonStyle" Value="{DynamicResource MahApps.Metro.Styles.MetroCalendarDayButtonStyle}" />
        <Setter Property="CalendarItemStyle" Value="{DynamicResource MahApps.Metro.Styles.MetroCalendarItemStyle}" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Calendar}">
                    <Grid x:Name="PART_Root"
                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                          Background="Transparent">
                        <CalendarItem x:Name="PART_CalendarItem"
                                      Background="{TemplateBinding Background}"
                                      BorderBrush="{TemplateBinding BorderBrush}"
                                      BorderThickness="{TemplateBinding BorderThickness}"
                                      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                      Style="{TemplateBinding CalendarItemStyle}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MahApps.Metro.Styles.MetroCalendar"
           BasedOn="{StaticResource MahApps.Metro.Styles.BaseMetroCalendar}"
           TargetType="{x:Type Calendar}">
        <Setter Property="FontFamily" Value="{DynamicResource ContentFontFamily}" />
        <Setter Property="FontSize" Value="{DynamicResource ContentFontSize}" />
    </Style>

    <!--  obsolete  -->
    <Style x:Key="MetroCalendar"
           BasedOn="{StaticResource MahApps.Metro.Styles.MetroCalendar}"
           TargetType="{x:Type Calendar}" />
</ResourceDictionary>