<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary mc:Ignorable="PresentationOptions" 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:sys="clr-namespace:System;assembly=mscorlib" xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">

	<SolidColorBrush x:Key="C1Calendar_Border_Brush" Color="#000B0B0B" PresentationOptions:Freeze="true" />
	
	<!-- Font settings -->
    <FontFamily x:Key="C1Calendar_Font">Arial</FontFamily>
    <sys:Double x:Key="C1Calendar_FontSize">11</sys:Double>
    <SolidColorBrush x:Key="C1Calendar_Foreground_Brush" Color="White" PresentationOptions:Freeze="true" />
	<SolidColorBrush x:Key="C1Calendar_Background" Color="Black" PresentationOptions:Freeze="true" />
    
    <!-- Month Header resources -->
    <FontFamily x:Key="C1Calendar_MonthHeader_Font">Arial</FontFamily>
    <sys:Double x:Key="C1Calendar_MonthHeader_FontSize">13</sys:Double>
    <LinearGradientBrush x:Key="C1Calendar_MonthHeader_Brush" EndPoint="0.5,0.005" StartPoint="0.5,0.967" PresentationOptions:Freeze="true">
        <GradientStop Color="#FF5D5D5D" Offset="0" />
        <GradientStop Color="#FFA7A7A7" Offset="1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="C1Calendar_MonthHeaderText_Brush" Color="Black" PresentationOptions:Freeze="true" />
    <FontWeight x:Key="C1Calendar_MonthHeader_FontWeight">Bold</FontWeight>
    <SolidColorBrush x:Key="C1Calendar_MonthHeader_MouseOverBrush" Color="LightGray" PresentationOptions:Freeze="true" />
    <SolidColorBrush x:Key="C1Calendar_NavArrow_Brush" Color="Black" PresentationOptions:Freeze="true" />

    <!-- Calendar days -->
    <LinearGradientBrush x:Key="C1Calendar_Today_Brush" EndPoint="0.5,0.005" StartPoint="0.5,0.967" PresentationOptions:Freeze="true">
        <GradientStop Color="#FF077BC7" Offset="0" />
        <GradientStop Color="#FFCDE9FC" Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="C1Calendar_SelectedDate_Brush" EndPoint="0.5,0.005" StartPoint="0.5,0.967" PresentationOptions:Freeze="true">
        <GradientStop Color="#FFB63B00" Offset="0" />
        <GradientStop Color="#FFFBC636" Offset="1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="C1Calendar_AdjucentDateText_Brush" Color="#FFCFCDCD" PresentationOptions:Freeze="true" />
    <SolidColorBrush x:Key="C1Calendar_Weekend_Brush" Color="White" PresentationOptions:Freeze="true" />

    <!-- additional resources -->

    <LinearGradientBrush x:Key="calendarBackground" EndPoint="0.5,0.005" StartPoint="0.5,0.967" PresentationOptions:Freeze="true">
        <GradientStop Color="#FF2F2F2F" Offset="0" />
        <GradientStop Color="#FF434343" Offset="1" />
    </LinearGradientBrush>

	<Style TargetType="{x:Type c1sched:C1CalendarItem}">
		<Style.Resources>
			<ControlTemplate x:Key="looklessButton" TargetType="{x:Type ToggleButton}">
				<Border>
					<ContentPresenter />
				</Border>
			</ControlTemplate>
            <Style TargetType="{x:Type RepeatButton}" x:Key="NavigationButtonStyle">
                <Setter Property="Focusable" Value="False" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="Margin" Value="7,2,7,2" />
            </Style>
            <Style x:Key="listSelectionCombo" TargetType="{x:Type ComboBox}">
				<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
				<Setter Property="Background" Value="Transparent" />
				<Setter Property="Margin" Value="2" />
				<Setter Property="Padding" Value="1" />
				<Setter Property="Focusable" Value="False" />
				<Setter Property="VerticalAlignment" Value="Center" />
				<Setter Property="VerticalContentAlignment" Value="Center" />
				<Setter Property="HorizontalContentAlignment" Value="Center" />
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type ComboBox}">
							<Border Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}" x:Name="brd" KeyboardNavigation.DirectionalNavigation="None" KeyboardNavigation.TabNavigation="None" SnapsToDevicePixels="true">
								<Grid>
									<Popup AllowsTransparency="true" Name="PART_Popup" Placement="Center" PlacementTarget="{Binding ElementName=SelectedItemBorder}" IsOpen="{TemplateBinding IsDropDownOpen}" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
										<Border x:Name="DropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderThickness="1" TextBlock.Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}">
											<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
										</Border>
									</Popup>
									<ToggleButton x:Name="SelectedItemBorder" Margin="{TemplateBinding Padding}" Focusable="false" Background="Transparent" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Release" Foreground="{TemplateBinding Foreground}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Template="{StaticResource looklessButton}">
										<ContentPresenter Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
									</ToggleButton>
								</Grid>
							</Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="SelectedItemBorder" Property="Foreground" Value="{DynamicResource C1Calendar_MonthHeader_MouseOverBrush}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
					</Setter.Value>
				</Setter>
                <Setter Property="ItemContainerStyle">
                    <Setter.Value>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Focusable" Value="False" />
                        </Style>
                    </Setter.Value>
                </Setter>
            </Style>
		</Style.Resources>
		<Setter Property="Height" Value="180" />
		<Setter Property="Width" Value="180" />
		<Setter Property="VerticalAlignment" Value="Top" />
		<Setter Property="HorizontalAlignment" Value="Left" />
		<Setter Property="Margin" Value="2" />
		<Setter Property="DaysOfWeekPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<UniformGrid Columns="7" Rows="1" />
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="DaysPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<UniformGrid Columns="7" Rows="6">
						<UniformGrid.InputBindings>
							<KeyBinding Key="Home" Command="ComponentCommands.MoveToHome" />
							<KeyBinding Key="Left" Command="ComponentCommands.MoveLeft" CommandParameter="-1" />
							<KeyBinding Key="Right" Command="ComponentCommands.MoveRight" CommandParameter="1" />
							<KeyBinding Key="Down" Command="ComponentCommands.MoveDown" CommandParameter="7" />
							<KeyBinding Key="Up" Command="ComponentCommands.MoveUp" CommandParameter="-7" />
							<KeyBinding Key="Left" Modifiers="Shift" Command="ComponentCommands.ExtendSelectionLeft" CommandParameter="-1" />
							<KeyBinding Key="Right" Modifiers="Shift" Command="ComponentCommands.ExtendSelectionRight" CommandParameter="1" />
							<KeyBinding Key="Down" Modifiers="Shift" Command="ComponentCommands.ExtendSelectionDown" CommandParameter="7" />
							<KeyBinding Key="Up" Modifiers="Shift" Command="ComponentCommands.ExtendSelectionUp" CommandParameter="-7" />
						</UniformGrid.InputBindings>
					</UniformGrid>
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate>
					<Grid Margin="{TemplateBinding Margin}">
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto" />
							<RowDefinition Height="Auto" />
							<RowDefinition />
						</Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Border Grid.Row="0" Grid.RowSpan="3" Grid.ColumnSpan="2" CornerRadius="8" Background="{StaticResource calendarBackground}" />
                        <Rectangle Grid.Row="0" Grid.ColumnSpan="2" RadiusX="7" RadiusY="7" Margin="1,4,1,0" Fill="#28000000" />
                        <Rectangle Grid.Row="0" Grid.ColumnSpan="2" RadiusX="7" RadiusY="7" Margin="2" Fill="{Binding Path=C1Calendar.MonthHeaderBackground}" />

                        <DockPanel VerticalAlignment="Center" Margin="1" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
                            <RepeatButton Name="prevMonth" DockPanel.Dock="Left" Visibility="{Binding ShowPreviousButton, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" Command="c1sched:C1Calendar.PreviousMonthCommand" Foreground="{Binding Path=C1Calendar.NavigationButtonBrush}" Style="{StaticResource NavigationButtonStyle}">
                                <RepeatButton.Template>
                                    <ControlTemplate>
                                        <Border Padding="{TemplateBinding Margin}" Background="Transparent">
                                            <Polygon x:Name="pol" Points="6,0 0,5 6,10" Fill="{TemplateBinding Foreground}" />
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="pol" Property="Fill" Value="{DynamicResource C1Calendar_MonthHeader_MouseOverBrush}" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </RepeatButton.Template>
                            </RepeatButton>
                            <RepeatButton Name="nextMonth" DockPanel.Dock="Right" Visibility="{Binding ShowNextButton, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" Command="c1sched:C1Calendar.NextMonthCommand" Foreground="{Binding Path=C1Calendar.NavigationButtonBrush}" Style="{StaticResource NavigationButtonStyle}">
                                <RepeatButton.Template>
                                    <ControlTemplate>
                                        <Border Padding="{TemplateBinding Margin}" Background="Transparent">
                                            <Polygon x:Name="pol" Points="0,0 6,5 0,10" Fill="{TemplateBinding Foreground}" />
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="pol" Property="Fill" Value="{DynamicResource C1Calendar_MonthHeader_MouseOverBrush}" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </RepeatButton.Template>
                            </RepeatButton>
                            <StackPanel Name="inMmcRoot" Orientation="Horizontal" TextBlock.FontFamily="{Binding Path=C1Calendar.MonthHeaderFontFamily}" TextBlock.FontSize="{Binding Path=C1Calendar.MonthHeaderFontSize}" TextBlock.FontWeight="{Binding Path=C1Calendar.MonthHeaderFontWeight}" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <ComboBox x:Name="PART_MonthsComboBox" Style="{StaticResource listSelectionCombo}" HorizontalAlignment="Right" Foreground="{Binding Path=C1Calendar.MonthHeaderForeground}">
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate DataType="{x:Type c1sched:DateTimeInfo}">
                                            <TextBlock Text="{Binding Path=MonthFullName}" />
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>
                                <ComboBox x:Name="PART_YearsComboBox" Style="{StaticResource listSelectionCombo}" HorizontalAlignment="Left" Foreground="{Binding Path=C1Calendar.MonthHeaderForeground}">
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate DataType="{x:Type c1sched:DateTimeInfo}">
                                            <TextBlock Text="{Binding Path=Year}" />
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>
                            </StackPanel>
                        </DockPanel>

                        <c1sched:DaysOfWeekPresenter Grid.Row="1" Grid.Column="1" />
                        <c1sched:WeekNumbersPresenter Grid.Row="2" Margin="5,0,0,0" Grid.Column="0" FontSize="8" Foreground="{DynamicResource C1Calendar_AdjucentDateText_Brush}" Visibility="{Binding Path=C1Calendar.ShowWeekNumbers,                                      Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                        <c1sched:C1CalendarItemPresenter Grid.Row="2" Grid.Column="1" />
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="DayOfWeekSlotTemplate">
			<Setter.Value>
				<DataTemplate>
					<TextBlock x:Name="DaySlotText" Text="{Binding Path=DayShortestName}" FontWeight="Medium" Padding="2" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=IsWeekend}" Value="True">
                            <Setter TargetName="DaySlotText" Property="Foreground" Value="{Binding Path=Owner.C1Calendar.WeekendBrush}" />
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="DaySlotTemplate">
			<Setter.Value>
				<DataTemplate>
					<c1sched:PilePanel>
						<Rectangle x:Name="selection" Margin="0,1,0,1" Fill="Transparent" />
						<Border x:Name="DaySlot" CornerRadius="4" Margin="1,2,1,2">
							<TextBlock x:Name="DaySlotText" Margin="2" Text="{Binding Path=Date.Day}" HorizontalAlignment="Center" VerticalAlignment="Center" />
						</Border>
					</c1sched:PilePanel>
					<DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=IsWeekend}" Value="True">
                            <Setter TargetName="DaySlotText" Property="Foreground" Value="{Binding Path=Owner.C1Calendar.WeekendBrush}" />
                        </DataTrigger>
						<DataTrigger Binding="{Binding Path=IsToday}" Value="True">
							<Setter TargetName="DaySlot" Property="Background" Value="{Binding Path=Owner.C1Calendar.TodayBrush}" />
						</DataTrigger>
						<DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
							<Setter TargetName="selection" Property="Fill" Value="{Binding Path=Owner.C1Calendar.SelectedDayBrush}" />
						</DataTrigger>
						<DataTrigger Binding="{Binding Path=IsBolded}" Value="True">
							<Setter TargetName="DaySlotText" Property="FontWeight" Value="Bold" />
                            <Setter TargetName="DaySlotText" Property="FontSize" Value="12" />
                        </DataTrigger>
						<MultiDataTrigger>
							<MultiDataTrigger.Conditions>
								<Condition Binding="{Binding Path=Empty}" Value="false" />
								<Condition Binding="{Binding Path=IsAdjacent}" Value="true" />
							</MultiDataTrigger.Conditions>
							<Setter TargetName="DaySlotText" Property="Foreground" Value="{Binding Path=Owner.C1Calendar.AdjacentMonthDayBrush}" />
						</MultiDataTrigger>
                        <DataTrigger Binding="{Binding Path=IsEnabled}" Value="False">
                            <Setter TargetName="DaySlotText" Property="Foreground" Value="{Binding Path=Owner.C1Calendar.DisabledDayBrush}" />
                        </DataTrigger>
                    </DataTemplate.Triggers>
				</DataTemplate>
			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>