<Styles xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <Styles.Resources>
      <ControlTheme x:Key="FluentCalendarButton" TargetType="Button">
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="FontSize" Value="20" />
        <Setter Property="Background" Value="{DynamicResource CalendarViewNavigationButtonBackground}" />
        <Setter Property="Template">
          <ControlTemplate>
            <!-- HCA was changed here to ensure nav arrows display correctly -->
            <ContentPresenter Name="Text" Background="{TemplateBinding Background}"
                              BorderBrush="{DynamicResource CalendarViewNavigationButtonBorderBrush}"
                              BorderThickness="{TemplateBinding BorderThickness}"
                              Content="{TemplateBinding Content}"
                              Margin="{TemplateBinding Padding}"
                              HorizontalContentAlignment="Stretch"
                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}">
              <ContentPresenter.Styles>
                <Style Selector="TextBlock">
                  <Setter Property="FontSize" Value="14" />
                  <Setter Property="Foreground" Value="#FFFFFF" />
                </Style>
              </ContentPresenter.Styles>
            </ContentPresenter>
          </ControlTemplate>
        </Setter>
      </ControlTheme>
    </Styles.Resources>
    
    <Style Selector="Calendar">
        <Setter Property="Foreground" Value="#FFFFFF" />
        <Setter Property="Background" Value="#13265a" />
        <Setter Property="BorderBrush" Value="#183171" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Template">
            <ControlTemplate>
                <StackPanel
                    Name="PART_Root"
                    HorizontalAlignment="Center"
                    ClipToBounds="True">
                    <CalendarItem
                        Name="PART_CalendarItem"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding CornerRadius}"
                        HeaderBackground="{TemplateBinding HeaderBackground}" />
                </StackPanel>
            </ControlTemplate>
        </Setter>
    </Style>
    
  <Style Selector="CalendarItem">
    <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
    <Setter Property="DayTitleTemplate">
      <Template x:DataType="x:String">
        <TextBlock Text="{Binding}"
                   Foreground="#FFFFFF"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="14" />
      </Template>
    </Setter>
    <Setter Property="Template">
      <ControlTemplate>
        <Border BorderThickness="{TemplateBinding BorderThickness}"
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                CornerRadius="{TemplateBinding CornerRadius}">
          <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" RowDefinitions="40,*" MinWidth="294">
            <Grid ColumnDefinitions="12,*,Auto,10,Auto,12">
              <Button Grid.Column="1" Name="PART_HeaderButton"
                      IsHitTestVisible="False"
                      Theme="{StaticResource FluentCalendarButton}"
                      Foreground="{TemplateBinding Foreground}"
                      HorizontalContentAlignment="Left" />
              <Button Name="PART_PreviousButton"
                      Grid.Column="2"
                      Theme="{StaticResource FluentCalendarButton}"
                      Foreground="{TemplateBinding Foreground}"
                      Padding="1"
                      HorizontalContentAlignment="Left">
                <!--Path mimics Segoe MDL2 Assets font glyph used in WinUI-->
                <Path Stroke="#FFFFFF"
                      StrokeThickness="1.5"
                      Data="M 0,7 L 7,0 L 14,7"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center" />
              </Button>
              <Button Name="PART_NextButton"
                      Grid.Column="4"
                      Theme="{StaticResource FluentCalendarButton}"
                      Foreground="{TemplateBinding Foreground}"
                      Padding="1"
                      HorizontalContentAlignment="Left">
                <!--Path mimics Segoe MDL2 Assets font glyph used in WinUI-->
                <Path Stroke="#FFFFFF"
                      StrokeThickness="1.5"
                      Data="M 0,0 L 7,7 L 14,0"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center" />
              </Button>
            </Grid>
            <!--Border below is used only for MonthView but it can't be moved inside of Grid because CalendarItem expects it to be empty and it will cause side-effects-->
            <Border Name="BackgroundLayer" Background="{TemplateBinding BorderBrush}" Margin="0,38,0,0" IsVisible="{Binding #PART_MonthView.IsVisible}" Grid.Row="1" />
            <Grid Name="PART_MonthView" Grid.Row="1" IsVisible="False" MinHeight="290">
              <Grid.RowDefinitions>
                <!--This should always be the week day names??-->
                <RowDefinition Height="38" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
              </Grid.ColumnDefinitions>
            </Grid>
            <Grid Name="PART_YearView"
                  Background="{TemplateBinding BorderBrush}"
                  MinHeight="290"
                  Grid.Row="1"
                  IsVisible="False">
              <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
              </Grid.ColumnDefinitions>
            </Grid>
          </Grid>
        </Border>
      </ControlTemplate>
    </Setter>
    <Style Selector="^ /template/ Button:pointerover > Path">
      <Setter Property="Stroke" Value="#FFFFFF" />
    </Style>
    <Style Selector="^ /template/ Button:pressed > Path">
      <Setter Property="Stroke" Value="#FFFFFF" />
    </Style>
  </Style>
  
  <Style Selector="CalendarDayButton">
    <Setter Property="ClickMode" Value="Release" />
    <Setter Property="MinWidth" Value="40" />
    <Setter Property="MinHeight" Value="40" />
    <Setter Property="Margin" Value="1" />
    <Setter Property="Padding" Value="0,0,0,0" />
    <!--These are actually set on the CalendarView in WinUI-->
    <!-- <Setter Property="Foreground" Value="{DynamicResource CalendarViewCalendarItemForeground}" /> -->
    <Setter Property="Foreground" Value="#FFFFFF" />
    <Setter Property="Background" Value="#13265a" />
    <!-- <Setter Property="Background" Value="{DynamicResource CalendarViewCalendarItemRevealBackground}" /> -->
    <Setter Property="BorderBrush" Value="{DynamicResource CalendarViewCalendarItemRevealBorderBrush}" />
    <Setter Property="BorderThickness" Value="2" />
    <Setter Property="FontSize" Value="20" />
    <Setter Property="ClipToBounds" Value="False" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Template">
      <ControlTemplate>
        <Panel>
          <!-- To mimic WinUI SystemFocusVisual, Focus visual is drawn outside the bounds of the item -->
          <Border Name="Root" Background="{TemplateBinding Background}"
                  BorderThickness="0" ClipToBounds="True">

            <ContentControl Name="Content"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            Content="{TemplateBinding Content}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            FontSize="{TemplateBinding FontSize}"
                            Margin="{TemplateBinding Padding}">
              <ContentControl.Styles>
                <Style Selector="TextBlock">
                  <Setter Property="Foreground" Value="#FFFFFF"></Setter>
                  <Setter Property="FontSize" Value="14"></Setter>
                </Style>
              </ContentControl.Styles>
            </ContentControl>
          </Border>
          <!-- Drawn Border should render on top of background to preserve the 1px margin between items-->
          <Border Name="Border"
                  BorderThickness="2"
                  BorderBrush="{TemplateBinding BorderBrush}" />
        </Panel>
      </ControlTemplate>
    </Setter>

    <Style Selector="^:pointerover /template/ Border#Border">
      <Setter Property="BorderBrush" Value="#2D77F3" />
      <!-- <Setter Property="BorderBrush" Value="{DynamicResource CalendarViewHoverBorderBrush}" /> -->
    </Style>

    <Style Selector="^:pressed /template/ Border#Border">
      <Setter Property="BorderBrush" Value="#2D77F3" />
      <!-- <Setter Property="BorderBrush" Value="{DynamicResource CalendarViewPressedBorderBrush}" /> -->
    </Style>

    <Style Selector="^:selected">
      <Style Selector="^ /template/ Border#Border">
        <Setter Property="BorderBrush" Value="{DynamicResource CalendarViewSelectedBorderBrush}" />
      </Style>
      <Style Selector="^:pointerover /template/ Border#Border">
        <Setter Property="BorderBrush" Value="{DynamicResource CalendarViewSelectedHoverBorderBrush}" />
      </Style>
      <Style Selector="^:pressed /template/ Border#Border">
        <Setter Property="BorderBrush" Value="{DynamicResource CalendarViewSelectedPressedBorderBrush}" />
      </Style>
    </Style>

    <Style Selector="^:today">
      <Style Selector="^ /template/ Border#Root">
        <Setter Property="Background" Value="{DynamicResource SystemAccentColor}" />
      </Style>
      <!-- These are probably set in code, but consistent -->
      <Style Selector="^:pointerover /template/ Border#Border">
        <Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColorDark1}" />
      </Style>
      <Style Selector="^:pressed /template/ Border#Border">
        <Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColorDark2}" />
      </Style>
      <Style Selector="^ ContentControl#Content">
        <Setter Property="Foreground" Value="{DynamicResource CalendarViewTodayForeground}" />
        <Setter Property="FontWeight" Value="SemiBold" />
      </Style>
    </Style>

    <!-- WinUI calls this OutOfFocus -->
    <Style Selector="^:inactive">
      <Style Selector="^ /template/ Border#Root">
        <Setter Property="Background">
          <Setter.Value>
            <SolidColorBrush Color="#FFFFFF" Opacity="0.1" />
          </Setter.Value>
        </Setter>
      </Style>
      <Style Selector="^ /template/ ContentControl#Content TextBlock">
        <Setter Property="Foreground" Value="#AAAAAA" />
      </Style>
    </Style>

    <!-- <Style Selector="^:blackout /template/ ContentControl#Content"> -->
      <!-- <Setter Property="Foreground" Value="{DynamicResource CalendarViewBlackoutForeground}" /> -->
      <!-- <Setter Property="TextBlock.Foreground" Value="Red" /> -->
    <!-- </Style> -->

    <!-- <Style Selector="^:disabled /template/ ContentControl#Content"> -->
      <!-- <Setter Property="TextBlock.Foreground" Value="Orange" /> -->

      <!-- <Setter Property="Foreground" Value="{DynamicResource CalendarViewWeekDayForegroundDisabled}" /> -->
    <!-- </Style> -->
  </Style>
</Styles>
