<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:c1sched="clr-namespace:C1.WPF.Schedule" xmlns:c1="clr-namespace:C1.WPF;assembly=C1.WPF.4">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/C1.WPF.Schedule.4;component/themes/SchedulerThemes/Office2016/Colorful.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Color & Brush used to build Base brushes -->
    <Color x:Key="BorderColor">#FF999999</Color>

    <!-- @ Base Colors used in Scheduler -->
    <Color x:Key="C1Scheduler_BaseColor">#FFF0F0F0</Color>
    <Color x:Key="C1Scheduler_Foreground">Black</Color>
    <SolidColorBrush x:Key="C1Scheduler_Foreground_Brush" Color="{StaticResource C1Scheduler_Foreground}" />

    <!-- ** Themeable C1Scheduler resources ** -->
    <Color x:Key="C1Scheduler_BaseBackgroundColor">#FFE1E1E1</Color>
    <SolidColorBrush x:Key="C1Scheduler_Background" Color="{StaticResource C1Scheduler_BaseBackgroundColor}" />

    <!-- The brush which is used as default value for C1Scheduler. ControlBackground property. 
       It is used for coloring control area background (time ruler, etc.). -->
    <SolidColorBrush x:Key="C1Scheduler_ControlArea_Brush" Color="#FF666666" />
    <SolidColorBrush x:Key="C1Scheduler_ControlAreaText_Brush" Color="White" />

    <!-- Current day -->
    <Color x:Key="C1Scheduler_Today_Color">#FF3A9362</Color>
    <!-- The brush which is used as default value for C1Scheduler.TodayBackground property. 
       It is used as a base color for co0loring current day elements. -->
    <SolidColorBrush x:Key="C1Scheduler_Today_Brush" Color="{StaticResource C1Scheduler_Today_Color}" />

    <!-- All-day area -->
    <Thickness x:Key="C1Scheduler_AllDayAreaBorder_Thickness">1,0,1,0</Thickness>
    <!-- All-day area for the current date -->
    <SolidColorBrush x:Key="C1Scheduler_AllDayArea_Brush" Color="#FFE1E1E1" />
    <SolidColorBrush x:Key="C1Scheduler_AllDayArea_SelectedBrush" Color="{StaticResource C1Scheduler_Selected_Color}" />

    <SolidColorBrush x:Key="C1Scheduler_Border_Brush" Color="#FFE1E1E1" />

    <!-- Time slots lines-->
    <SolidColorBrush x:Key="C1Scheduler_WorkHour_Brush" Color="#FFF0F0F0" />
    <SolidColorBrush x:Key="C1Scheduler_WorkHourBorder_Brush" Color="#FFE1E1E1" />
    <SolidColorBrush x:Key="C1Scheduler_FreeHour_Brush" Color="#FFD4D4D4" />
    <SolidColorBrush x:Key="C1Scheduler_FreeHourBorder_Brush" Color="#FFE1E1E1" />

    <!-- Alternate month day background (used in a month view) -->
    <SolidColorBrush x:Key="C1Scheduler_AlternateMonthDay_Brush" Color="#FFF0F0F0" />

    <!-- The brush which is used as default value for C1Scheduler.AppointmentForeground property. 
       It is used for displaying appointment text. -->
    <SolidColorBrush x:Key="C1Scheduler_AppointmentForeground_Brush" Color="{StaticResource C1Scheduler_Foreground}" />
    <!-- Appointment background mask brush -->
    <SolidColorBrush x:Key="C1Scheduler_AppointmentBgMask_Brush" Color="#283A9362"/>

    <!-- Week tabs in a month view -->
    <SolidColorBrush x:Key="C1Scheduler_WeekTab_Brush" Color="#FFD4D4D4" />

    <!-- ** C1BrushBuilder styles ** -->

    <!-- C1BrushBuilder style which is used for coloring borders of navigation panes, day headers and week tabs. -->
    <Style x:Key="C1Scheduler_Border_Style" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{StaticResource BorderColor}" />
        <Setter Property="DesignBrush" Value="{StaticResource C1Scheduler_Border_Brush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring month header. -->
    <Style x:Key="C1Scheduler_MonthHeaderForeground_BrushStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{StaticResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{StaticResource C1Scheduler_ControlAreaText_Brush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring control area background. -->
    <Style x:Key="C1Scheduler_ControlArea_BrushStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{StaticResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{StaticResource C1Scheduler_ControlArea_Brush}" />
    </Style>
    <Style x:Key="C1Scheduler_ControlAreaDark_BrushStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="#FFE9E9E9" />
        <Setter Property="DesignBrush" Value="#FFE1E1E1" />
    </Style>
    <!-- ** End of C1BrushBuilder styles ** -->

    <!-- determines the template used for displaying group headers -->
    <DataTemplate  x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler}, ResourceId=GroupHeaderTemplate}">
        <Grid SnapsToDevicePixels="True" Background="Transparent">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <c1:C1BrushBuilder x:Name="Background" Style="{StaticResource C1Scheduler_ControlArea_BrushStyle}" Input="{Binding Background}" />
            <c1:C1BrushBuilder x:Name="BorderBrush" Style="{StaticResource C1Scheduler_MonthHeaderForeground_BrushStyle}" Input="{Binding Background}" />
            <Button Style="{StaticResource GroupHeaderButton}" Grid.Column="0" VerticalAlignment="Center" Margin="4" Command="c1sched:C1Scheduler.NavigateToPreviousGroupCommand" CommandTarget="{Binding Scheduler}" Visibility="{Binding ShowPreviousButton, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" BorderBrush="{Binding Output, ElementName=BorderBrush}" Background="{Binding Output, ElementName=Background}">
                <Path Data="M4.5352716,0 C4.7911787,0 5.0470867,0.097625732 5.2423372,0.29287648 C5.6328392,0.68337822 5.6328392,1.3165059 5.2423372,1.7070076 L3.1820319,3.7673135 L8.2674026,3.7673135 C8.8196878,3.7673135 9.2674026,4.2150288 9.2674026,4.7673135 C9.2674026,5.3195982 8.8196878,5.7673135 8.2674026,5.7673135 L3.1816781,5.7673135 L5.2423363,7.8279719 C5.6328382,8.2184734 5.6328382,8.8516016 5.2423363,9.2421036 C4.8518353,9.6326046 4.2187071,9.6326046 3.8282053,9.2421026 L0.29287642,5.7067738 C-0.32626158,5.064395 -0.32671508,4.5018373 0.29287884,3.8282032 L3.8282061,0.29287601 C4.0234566,0.097625256 4.2793646,-2.3841858E-07 4.5352716,0 z" Fill="{Binding Output, ElementName=BorderBrush}" Stretch="Fill" Height="10" Width="10" />
            </Button>
            <Button Style="{StaticResource GroupHeaderButton}" Grid.Column="2" VerticalAlignment="Center" Margin="4" Command="c1sched:C1Scheduler.NavigateToNextGroupCommand" CommandTarget="{Binding Scheduler}" Visibility="{Binding ShowNextButton, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" BorderBrush="{Binding Output, ElementName=BorderBrush}" Background="{Binding Output, ElementName=Background}">
                <Path Data="M4.7322359,0 C4.9881582,2.3841858E-07 5.2440805,0.097631216 5.4393425,0.29289341 L8.9748764,3.8284273 C9.5511045,4.4046021 9.5983429,5.0837431 8.9748774,5.7071066 L5.4393435,9.2426405 C5.0488191,9.6331644 4.4156542,9.6331644 4.0251298,9.2426405 C3.6346054,8.8521166 3.6346054,8.2189512 4.0251298,7.8284273 L6.0857897,5.767767 L0.99999994,5.767767 C0.44771519,5.767767 -5.2450769E-08,5.3200521 3.5527137E-15,4.767767 C-5.2450769E-08,4.2154822 0.44771519,3.7677672 0.99999994,3.7677672 L6.0857897,3.7677672 L4.0251293,1.7071068 C3.6346049,1.3165827 3.6346049,0.68341756 4.0251293,0.29289341 C4.2203913,0.097631216 4.4763136,2.3841858E-07 4.7322359,0 z" Fill="{Binding Output, ElementName=BorderBrush}" Stretch="Fill" Height="10" Width="10" />
            </Button>
            <TextBlock Foreground="{Binding Path=Scheduler.Foreground}" Margin="10,4,10,4" Grid.Column="1" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}, ConverterParameter=Invert}" Text="{Binding DisplayName}" VerticalAlignment="Center" HorizontalAlignment="Center" />
            <TextBlock Foreground="{Binding Path=Scheduler.Foreground}" Margin="10,4,10,4" Grid.Column="1" FontWeight="Bold" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" Text="{Binding DisplayName}" VerticalAlignment="Center" HorizontalAlignment="Center" />
        </Grid>
    </DataTemplate>

    <!-- determines the style used for displaying time slots in a Day view.
         Copy it into every theme, as using DynamicResource here affects performance -->
    <c1sched:TimeSlotStyleSelector x:Key="TimeSlotStyleSelector">
        <!-- Don't use selection states. With selection states multiple selection works incorrectly. -->
        <c1sched:TimeSlotStyleSelector.Resources>
            <ResourceDictionary>
                <Style x:Key="C1Scheduler_TopWorkSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_WorkHourBorder_Brush}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="c1sched:VisualIntervalPresenter">
                                <Grid>
                                    <Border Background="{Binding Path=Scheduler.AlternatingBackground}" IsHitTestVisible="False" BorderThickness="0,1,0,0" BorderBrush="{TemplateBinding BorderBrush}">
                                        <Rectangle Fill="{StaticResource C1Scheduler_Selected_Brush}" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                                    </Border>
                                    <ContentPresenter Content="{TemplateBinding Content}" Margin="0,1,0,0" ContentTemplate="{TemplateBinding ContentTemplate}" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

                <Style x:Key="C1Scheduler_WorkSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_WorkHourBorder_Brush}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="c1sched:VisualIntervalPresenter">
                                <Grid>
                                    <Border Background="{Binding Path=Scheduler.AlternatingBackground}" IsHitTestVisible="False" >
                                        <Rectangle Fill="{StaticResource C1Scheduler_Selected_Brush}" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                                    </Border>
                                    <Line Stroke="{TemplateBinding BorderBrush}" HorizontalAlignment="Stretch" X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}"
                                        StrokeDashArray="2 2" StrokeThickness="1" VerticalAlignment="Top" />
                                    <ContentPresenter Content="{TemplateBinding Content}" Margin="0,1,0,0" ContentTemplate="{TemplateBinding ContentTemplate}" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

                <Style x:Key="C1Scheduler_FreeSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourBorder_Brush}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="c1sched:VisualIntervalPresenter">
                                <Grid>
                                    <Border Background="{StaticResource C1Scheduler_FreeHour_Brush}" IsHitTestVisible="False" >
                                        <Rectangle Fill="{StaticResource C1Scheduler_Selected_Brush}" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                                    </Border>
                                    <Line Stroke="{TemplateBinding BorderBrush}" HorizontalAlignment="Stretch" X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}"
                                        StrokeDashArray="2 2" StrokeThickness="1" VerticalAlignment="Top" />
                                    <ContentPresenter Content="{TemplateBinding Content}" Margin="0,1,0,0" ContentTemplate="{TemplateBinding ContentTemplate}" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

                <Style x:Key="C1Scheduler_TopFreeSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourBorder_Brush}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="c1sched:VisualIntervalPresenter">
                                <Grid>
                                    <Border Background="{StaticResource C1Scheduler_FreeHour_Brush}" BorderThickness="0,1,0,0" IsHitTestVisible="False" BorderBrush="{TemplateBinding BorderBrush}">
                                        <Rectangle Fill="{StaticResource C1Scheduler_Selected_Brush}" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                                    </Border>
                                    <ContentPresenter Content="{TemplateBinding Content}" Margin="0,1,0,0" ContentTemplate="{TemplateBinding ContentTemplate}" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

            </ResourceDictionary>
        </c1sched:TimeSlotStyleSelector.Resources>
    </c1sched:TimeSlotStyleSelector>

    <!-- Determines the style used for displaying time slots in the TimeLine view.
         Copy it into every theme, as using DynamicResource here affects performance -->
    <c1sched:TimeSlotStyleSelector x:Key="HorizontalTimeSlotStyleSelector">
        <c1sched:TimeSlotStyleSelector.Resources>
            <ResourceDictionary>
                <Style x:Key="C1Scheduler_WorkSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_WorkHourBorder_Brush}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="c1sched:VisualIntervalPresenter">
                                <Grid>
                                    <Border x:Name="IntervalBorder" IsHitTestVisible="False" Background="{Binding Path=Scheduler.AlternatingBackground}" BorderThickness="1,0,0,0" BorderBrush="{TemplateBinding BorderBrush}">
                                        <Rectangle Fill="{StaticResource C1Scheduler_Selected_Brush}" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                                    </Border>
                                    <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="1,0,0,0" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

                <Style x:Key="C1Scheduler_TopWorkSlot_Style" BasedOn="{StaticResource C1Scheduler_WorkSlot_Style}" TargetType="c1sched:VisualIntervalPresenter">
                </Style>

                <Style x:Key="C1Scheduler_FreeSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourBorder_Brush}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="c1sched:VisualIntervalPresenter">
                                <Grid>
                                    <Border x:Name="IntervalBorder" IsHitTestVisible="False" Background="{StaticResource C1Scheduler_FreeHour_Brush}" BorderThickness="1,0,0,0" BorderBrush="{TemplateBinding BorderBrush}">
                                        <Rectangle Fill="{StaticResource C1Scheduler_Selected_Brush}" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                                    </Border>
                                    <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="1,0,0,0" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

                <Style x:Key="C1Scheduler_TopFreeSlot_Style" BasedOn="{StaticResource C1Scheduler_FreeSlot_Style}" TargetType="c1sched:VisualIntervalPresenter">
                </Style>
            </ResourceDictionary>
        </c1sched:TimeSlotStyleSelector.Resources>
    </c1sched:TimeSlotStyleSelector>

    <!-- very simple Group Header for the TimeLine view -->
    <DataTemplate x:Key="TimeLineGroupHeaderTemplate">
        <Grid IsHitTestVisible="False">
            <c1:C1BrushBuilder x:Name="Background" Style="{StaticResource C1Scheduler_ControlAreaDark_BrushStyle}" Input="{Binding Background}" />
            <Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderThickness="4,1,0,1" 
                    BorderBrush="{StaticResource C1Scheduler_Border_Brush}" Background="{Binding Output, ElementName=Background}">
                <TextBlock TextWrapping="Wrap" Foreground="{Binding Path=Scheduler.Foreground}" Margin="2" Text="{Binding DisplayName}" VerticalAlignment="Center" HorizontalAlignment="Center" />
            </Border>
        </Grid>
    </DataTemplate>

    <Style x:Key="C1Scheduler_WeekTab_Style" TargetType="Button">
        <Setter Property="FontSize" Value="12" />
        <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_AllDayArea_Brush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border BorderThickness="1, 0, 0, 0" BorderBrush="{TemplateBinding BorderBrush}" Background="{StaticResource C1Scheduler_WeekTab_Brush}">
                        <ContentPresenter Content="{TemplateBinding Content}" Margin="1" 
                                          ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <c1sched:AlternateMonthBrushConverter x:Key="AlternateMonthBrushConverter" AlternateMonthBrush="{StaticResource C1Scheduler_AlternateMonthDay_Brush}" />

    <Style x:Key="C1Scheduler_Day_Style" TargetType="ListBoxItem">
        <Setter Property="BorderThickness" Value="0,0,1,1" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="root" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{StaticResource C1Scheduler_Border_Brush}" 
                            Background="{Binding Converter={StaticResource AlternateMonthBrushConverter}}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Button HorizontalContentAlignment="Left" CommandParameter="{Binding Path=Scheduler.OneDayStyle}" Command="c1sched:C1Scheduler.ChangeStyleCommand" 
                                    Style="{DynamicResource C1Scheduler_DayHeaderButton_Style}" BorderThickness="0">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Margin="2" Text="{Binding Converter={x:Static c1sched:VisualIntervalToStringConverter.Default}, ConverterParameter=MonthViewDayHeaderDayFormat}" />
                                    <TextBlock x:Name="MonthName" Margin="2,2,0,2" Text="{Binding Converter={x:Static c1sched:MonthToStringConverter.Default}}" />
                                </StackPanel>
                            </Button>
                            <ContentPresenter Content="{TemplateBinding Content}" Grid.Row="1" ContentTemplate="{StaticResource VisualIntervalTemplate}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsSelected}" Value="True">
                            <Setter TargetName="root" Property="Background" Value="{Binding Scheduler.SelectedBackground}" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>