<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml">
	
	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="pack://application:,,,/C1.WPF.Schedule.4;component/themes/SchedulerThemes/Office2007/Default.xaml" />
	</ResourceDictionary.MergedDictionaries>

    <!-- determines the style used for displaying single day in custom views -->
    <c1:DayIntervalStyleSelector x:Key="DayStyleSelector">
        <c1:DayIntervalStyleSelector.Resources>
            <ResourceDictionary>
                <DataTemplate x:Key="DayHeaderTemplate">
                    <Button HorizontalContentAlignment="Stretch" VerticalContentAlignment="Center" CommandParameter="{Binding Path=Scheduler.OneDayStyle}" Command="c1:C1Scheduler.ChangeStyleCommand" BorderThickness="0,1px,0,1px" Style="{DynamicResource C1Scheduler_DayHeaderButton_Style}">
                        <DockPanel>
                            <TextBlock DockPanel.Dock="Right" Padding="0, 2, 3, 3" FontWeight="Semibold" Text="{Binding Converter={x:Static c1:VisualIntervalToStringConverter.Default}, ConverterParameter=DayViewDayHeaderFormat}" HorizontalAlignment="Right" />
                            <!-- Add empty block to fill panel (it's needed for command) -->
                            <TextBlock />
                        </DockPanel>
                    </Button>
                </DataTemplate>

                <DataTemplate x:Key="VisualIntervalTemplate">
                    <Grid>
                        <Border x:Name="DayContentBorder" SnapsToDevicePixels="True" c1:AppointmentsCoverPane.KeepTimesAtDrop="True" c1:CoverElementsPane.Orientation="Horizontal" Background="{DynamicResource C1Scheduler_AlternateMonthDay_Brush}" />
                        <Border Background="{Binding Path=Scheduler.SelectedBackground}" Visibility="{Binding IsSelected, Converter={x:Static c1:BooleanToVisibilityConverter.Default}}" />
                        <Border Name="highlightStatusBorder" Background="{Binding Path=StatusBrush}" Opacity="0.2" />
                        <Button Name="overflowJumper" HorizontalAlignment="Right" Foreground="{Binding Path=Scheduler.Foreground}" CommandParameter="{Binding Path=Scheduler.OneDayStyle}" Command="c1:C1Scheduler.ChangeStyleCommand" VerticalAlignment="Bottom" Visibility="{Binding Path=(c1:CoverElementsPane.CoverElementsOverflow),                                 ElementName=DayContentBorder, Converter={x:Static c1:BooleanToVisibilityConverter.Default}}" Style="{DynamicResource C1Scheduler_OverflowJumper_Style}" />
                    </Grid>
                    <DataTemplate.Triggers>
                        <DataTrigger Value="1">
                            <DataTrigger.Binding>
                                <MultiBinding Converter="{x:Static c1:DoubleArithmeticOperationMultiConverter.Default}" ConverterParameter="Modulus">
                                    <Binding Path="StartTime.Month" Mode="OneTime" />
                                    <Binding Source="2" />
                                </MultiBinding>
                            </DataTrigger.Binding>
                            <Setter TargetName="DayContentBorder" Property="Background" Value="{Binding Path=Scheduler.AlternatingBackground}" />
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>

                <!-- determines the style of the day header. It is used in all Office 2007 views -->
                <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">
                                <Grid>
                                    <c1:C1BrushBuilder x:Name="BorderBrush" Input="{Binding Path=DataContext.Scheduler.Background, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource C1Scheduler_Border_Style}" />
                                    <Border x:Name="DayBorder" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{Binding ElementName=BorderBrush, Path=Output}">
                                        <DockPanel>
                                            <ContentPresenter Content="{TemplateBinding Content}" DockPanel.Dock="Top" ContentTemplate="{StaticResource DayHeaderTemplate}" />
                                            <!-- don't use binding for ContentTemplate, it cause 
                             System.ExecutionEngineException at changing scheduler theme.  -->
                                            <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{StaticResource VisualIntervalTemplate}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                                        </DockPanel>
                                    </Border>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

                <!-- determines the style of the today header. It is used in all Office 2007 views -->
                <Style x:Key="C1Scheduler_Today_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">
                                <Grid>
                                    <c1:C1BrushBuilder x:Name="BorderBrush" Input="{Binding Path=DataContext.Scheduler.Background, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource C1Scheduler_Border_Style}" />
                                    <Border x:Name="DayBorder" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{Binding ElementName=BorderBrush, Path=Output}">
                                        <DockPanel>
                                            <ContentPresenter Content="{TemplateBinding Content}" DockPanel.Dock="Top" ContentTemplate="{StaticResource DayHeaderTemplate}" />
                                            <Border BorderBrush="{Binding Path=DataContext.Scheduler.TodayBackground, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="2,1,2,2">
                                                <!-- don't use binding for ContentTemplate, it cause 
                                                 System.ExecutionEngineException at changing scheduler theme.  -->
                                                <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{StaticResource VisualIntervalTemplate}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                                            </Border>
                                        </DockPanel>
                                    </Border>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ResourceDictionary>
        </c1:DayIntervalStyleSelector.Resources>
    </c1:DayIntervalStyleSelector>

    <!-- Style that represents Week View -->
    <Style x:Key="BaseCustomStyle" TargetType="{x:Type c1:C1Scheduler}" BasedOn="{StaticResource BaseViewStyle}">
        <Setter Property="FontSize" Value="12" />
        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="c1:C1Scheduler.VisualTimeSpan" Value="7" />
        <Setter Property="c1:C1Scheduler.VisualIntervalScale" Value="1" />
        <Setter Property="SmallStartTimeChange" Value="7" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type c1:C1Scheduler}">
                    <!-- set DataContext to the first visible group item -->
                    <Grid Background="{TemplateBinding Background}" DataContext="{Binding VisibleGroupItems[0], RelativeSource={RelativeSource TemplatedParent}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <c1:C1SchedulerPresenter Grid.Column="0" ItemContainerStyleSelector="{StaticResource DayStyleSelector}" />
                        <ScrollBar x:Name="PART_C1SchedulerScrollBar" Grid.Column="1" Orientation="Vertical" />
                        <c1:AppointmentsCoverPane Grid.Column="0" CoverElementsMargin="10" Background="Transparent" IsDragDropDisabled="{Binding RelativeSource={RelativeSource TemplatedParent},            Path=IsDragDropDisabled}">
                            <c1:AppointmentsCoverPane.Resources>
                                <ResourceDictionary>
                                    <Thickness x:Key="TimeBorderThickness">0</Thickness>
                                </ResourceDictionary>
                            </c1:AppointmentsCoverPane.Resources>
                        </c1:AppointmentsCoverPane>
                        <ContentControl Name="nextPrevAppPane" Grid.Column="0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" DataContext="{Binding VisibleGroupItems[0], RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource C1Scheduler_PrevNextAppPane_Style}" Visibility="{Binding HasVisibleAppointments, Converter={x:Static c1:BooleanToVisibilityConverter.Default}, ConverterParameter=Invert, RelativeSource={RelativeSource TemplatedParent}}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VisualIntervalGroupDescriptions" Value="{x:Null}" />
        <Setter Property="VisualIntervalGroupStyles" Value="{x:Null}" />
    </Style>

    <!-- Style that represents Week View -->
    <Style x:Key="CustomWeekStyle" TargetType="{x:Type c1:C1Scheduler}" BasedOn="{StaticResource BaseCustomStyle}">
		<Setter Property="VisualIntervalPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<c1:AutoDistributionGrid ChildrenFlowDirection="Vertical" RowCount="6" ColumnCount="2">
						<c1:AutoDistributionGrid.ChildrenDistributionInfo>
							<c1:DistributionInfo ElementIndex="0" RowSpan="2" Propagate="4" />
						</c1:AutoDistributionGrid.ChildrenDistributionInfo>
					</c1:AutoDistributionGrid>
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- Style that represents 2 Week View -->
    <Style x:Key="CustomTwoWeekStyle" TargetType="{x:Type c1:C1Scheduler}" BasedOn="{StaticResource BaseCustomStyle}">
		<Setter Property="c1:C1Scheduler.VisualTimeSpan" Value="14" />
		<Setter Property="SmallStartTimeChange" Value="14" />
		<Setter Property="VisualIntervalPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<c1:AutoDistributionGrid ChildrenFlowDirection="Vertical" RowCount="6" ColumnCount="4">
						<c1:AutoDistributionGrid.ChildrenDistributionInfo>
							<c1:DistributionInfo ElementIndex="0" Row="0" Column="0" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="1" Row="1" Column="0" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="2" Row="2" Column="0" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="3" Row="3" Column="0" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="4" Row="4" Column="0" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="5" Row="5" Column="0" />
							<c1:DistributionInfo ElementIndex="6" Row="5" Column="1" />
							<c1:DistributionInfo ElementIndex="7" Row="0" Column="2" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="8" Row="1" Column="2" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="9" Row="2" Column="2" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="10" Row="3" Column="2" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="11" Row="4" Column="2" ColumnSpan="2" />
							<c1:DistributionInfo ElementIndex="12" Row="5" Column="2" />
							<c1:DistributionInfo ElementIndex="13" Row="5" Column="3" />
						</c1:AutoDistributionGrid.ChildrenDistributionInfo>
					</c1:AutoDistributionGrid>
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- Style that represents Working Week View -->
    <Style x:Key="CustomWorkingWeekStyle" TargetType="{x:Type c1:C1Scheduler}" BasedOn="{StaticResource BaseCustomStyle}">
		<Setter Property="VisualIntervalPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<UniformGrid Rows="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
</ResourceDictionary>