<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:c1="clr-namespace:C1.WPF;assembly=C1.WPF.4" xmlns:c1sched="clr-namespace:C1.WPF.Schedule" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

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

    <!-- ** Themeable C1Scheduler resources ** -->
    <!-- @ MS Office 2007 Blue Color -->
    <Color x:Key="C1Scheduler_BaseBackgroundColor">#FFC2D4EB</Color>
    <SolidColorBrush x:Key="DisabledBrush" Color="#8CFFFFFF" />
    
    <!-- @ Base Colors used in Scheduler -->
    <Color x:Key="C1Scheduler_BaseColor">#FF5A8ECE</Color>
    <!-- The brush which is used as control’s Background property default value. -->
    <SolidColorBrush x:Key="C1Scheduler_Background" Color="{StaticResource C1Scheduler_BaseBackgroundColor}" />
    <!-- The brush which is used as control’s BorderBrush property default value. -->
    <SolidColorBrush x:Key="C1Scheduler_Border_Brush" Color="{StaticResource C1Scheduler_BaseColor}" />
    <!-- The brush which is used as control’s Foreground property default value. -->
    <SolidColorBrush x:Key="C1Scheduler_Foreground_Brush" Color="{DynamicResource {x:Static SystemColors.ControlTextColorKey}}" />

    <Color x:Key="C1Scheduler_Selected_Color">#332D71C0</Color>
    <!-- The brush which is used as default value for C1Scheduler.SelectedBackground property. 
       It is used for coloring selected day background in a Month view. -->
    <SolidColorBrush x:Key="C1Scheduler_Selected_Brush" Color="{StaticResource C1Scheduler_Selected_Color}" />

    <!-- 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="#FFE7EFFF" />
    <!-- The brush which is used as default value for C1Scheduler. ControlForeground property. 
       It is used for coloring control area text and lines (time ruler, etc.). -->
    <SolidColorBrush x:Key="C1Scheduler_ControlAreaText_Brush" Color="#FF6392CE" />

	<!-- Navigation panels -->
    <!-- The brush which is used for coloring navigation panes. -->
    <LinearGradientBrush x:Key="C1Scheduler_NavPane_Brush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFBBCFE9" Offset="0" />
        <GradientStop Color="#FF94B3DB" Offset="0.5" />
        <GradientStop Color="#FF90B0DA" Offset="0.6" />
        <GradientStop Color="#FF8DAED9" Offset="1" />
    </LinearGradientBrush>
    <!-- The brush which is used for coloring navigation panes when mouse is over. -->
    <LinearGradientBrush x:Key="C1Scheduler_NavPane_HoverBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFBFD2EA" Offset="0" />
        <GradientStop Color="#FFA7C0E1" Offset="0.5" />
        <GradientStop Color="#FFA4BEE1" Offset="0.6" />
        <GradientStop Color="#FFA2BDE0" Offset="1" />
    </LinearGradientBrush>

    <!-- Day header -->
    <!-- The brush which is used for coloring day headers. -->
    <LinearGradientBrush x:Key="C1Scheduler_DayHeader_Brush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFE7EFF7" Offset="0" />
        <GradientStop Color="#FFDBE8F4" Offset="0.5" />
        <GradientStop Color="#FFBFD4EA" Offset="0.55" />
        <GradientStop Color="#FFE5EEF7" Offset="1" />
    </LinearGradientBrush>
    <!-- The brush which is used for coloring day headers when mouse is over. -->
    <LinearGradientBrush x:Key="C1Scheduler_DayHeader_HoverBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFE8EFF7" Offset="0" />
        <GradientStop Color="#FFE0E9F4" Offset="0.5" />
        <GradientStop Color="#FFD5E2F1" Offset="0.55" />
        <GradientStop Color="#FFDCE7F3" Offset="1" />
    </LinearGradientBrush>
    <Thickness x:Key="C1Scheduler_DayHeaderBorder_Thickness">1</Thickness>
    <Thickness x:Key="C1Scheduler_MonthViewDayHeaderBorder_Thickness">0,1,1,1</Thickness>

    <!-- Current day -->
    <Color x:Key="C1Scheduler_Today_Color">#FFEF9B1F</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}" />
    <!-- The brush which is used for coloring the current day header. -->
    <LinearGradientBrush x:Key="C1Scheduler_TodayHeader_Brush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFFBD295" Offset="0" />
        <GradientStop Color="#FFF9C373" Offset="0.5" />
        <GradientStop Color="#FFEF9B1F" Offset="0.55" />
        <GradientStop Color="#FFFDC065" Offset="1" />
    </LinearGradientBrush>
    <!-- The brush which is used for coloring the current day header when mouse is over. -->
    <LinearGradientBrush x:Key="C1Scheduler_TodayHeader_HoverBrush" EndPoint="1,0.5" StartPoint="0,0.5">
        <GradientStop Color="#7FFFC267" />
        <GradientStop Color="#7FFFEED6" Offset="0.5" />
        <GradientStop Color="#7FFFC267" Offset="1" />
    </LinearGradientBrush>

    <!-- All-day area -->
    <Thickness x:Key="C1Scheduler_AllDayAreaBorder_Thickness">1,0,1,2</Thickness>
    <!-- All-day area for the current date -->
    <Thickness x:Key="C1Scheduler_AllDayAreaTodayBorder_Thickness">2,1,2,2</Thickness>
    <SolidColorBrush x:Key="C1Scheduler_AllDayArea_Brush" Color="#FFa5bfe1" />
    <SolidColorBrush x:Key="C1Scheduler_AllDayArea_SelectedBrush" Color="#FF294c7a" />

    <!-- Time slots lines-->
    <SolidColorBrush x:Key="C1Scheduler_WorkHour_Brush" Color="White" />
    <SolidColorBrush x:Key="C1Scheduler_WorkHourBorder_Brush" Color="#19000000" />
    <SolidColorBrush x:Key="C1Scheduler_WorkHourLightBorder_Brush" Color="#3FFFFFFF" />
    <SolidColorBrush x:Key="C1Scheduler_FreeHour_Brush" Color="#99FFFFFF" />
    <SolidColorBrush x:Key="C1Scheduler_FreeHourBorder_Brush" Color="#19000000" />
    <SolidColorBrush x:Key="C1Scheduler_FreeHourLightBorder_Brush" Color="#3FFFFFFF" />
    <SolidColorBrush x:Key="C1Scheduler_TimeSlot_SelectedBrush" Color="#FF294C7A" />
    <Color x:Key="C1Scheduler_TimeSlot_SelectedColor">#FF294C7A</Color>

    <!-- Week tabs in a month view -->
    <!-- The brush which is used for coloring week tabs. -->
    <LinearGradientBrush x:Key="C1Scheduler_WeekTab_Brush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFE4ECF6" Offset="0" />
        <GradientStop Color="#FFD5E1F1" Offset="0.5" />
        <GradientStop Color="#FFC3D5EC" Offset="0.55" />
        <GradientStop Color="#FFD0DDEF" Offset="1" />
    </LinearGradientBrush>
    <!-- The brush which is used for coloring week tabs when mouse is over. -->
    <LinearGradientBrush x:Key="C1Scheduler_WeekTab_HoverBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFE4EBF6" Offset="0" />
        <GradientStop Color="#FFDCE6F3" Offset="0.5" />
        <GradientStop Color="#FFD2E0F0" Offset="0.55" />
        <GradientStop Color="#FFD9E3F2" Offset="1" />
    </LinearGradientBrush>

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

    <!-- Appointment background mask brush -->
    <LinearGradientBrush x:Key="C1Scheduler_AppointmentBgMask_Brush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#80FFFFFF" Offset="0" />
        <GradientStop Color="#00FFFFFF" Offset="1" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="MouseOverGradientBorderBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FF99C1E2" Offset="0.05" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="MouseOverGradientBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#20FFFFFF" Offset="1" />
        <GradientStop Color="#00FFFFFF" Offset="0" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="SelectedAppointmentBorderBrush" Color="Black" />

    <!-- 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="{DynamicResource {x:Static SystemColors.WindowTextColorKey}}" />

    <!-- ** End of themeable C1Scheduler resources ** -->

    <!-- ** 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="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_Border_Brush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring navigation panels. -->
    <Style x:Key="C1Scheduler_NavPane_Style" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_NavPane_Brush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring navigation panels when mouse is over. -->
    <Style x:Key="C1Scheduler_NavPane_HoverStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_NavPane_HoverBrush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring day headers. -->
    <Style x:Key="C1Scheduler_DayHeader_Style" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_DayHeader_Brush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring day headers when mouse is over. -->
    <Style x:Key="C1Scheduler_DayHeader_HoverStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_DayHeader_HoverBrush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring All-Day area. -->
    <Style x:Key="C1Scheduler_AllDayArea_Style" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_AllDayArea_Brush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring selected All-Day area. -->
    <Style x:Key="C1Scheduler_AllDayAreaSelected_Style" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_AllDayArea_SelectedBrush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring week tabs. -->
    <Style x:Key="C1Scheduler_WeekTab_BrushStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_WeekTab_Brush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring week tabs when mouse is over. -->
    <Style x:Key="C1Scheduler_WeekTab_HoverBrushStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_WeekTab_HoverBrush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring today header. -->
    <Style x:Key="C1Scheduler_TodayHeader_BrushStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_Today_Color}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_TodayHeader_Brush}" />
    </Style>
    <!-- C1BrushBuilder style which is used for coloring today header when mouse is over. -->
    <Style x:Key="C1Scheduler_TodayHeader_HoverBrushStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{DynamicResource C1Scheduler_Today_Color}" />
        <Setter Property="DesignBrush" Value="{DynamicResource C1Scheduler_TodayHeader_HoverBrush}" />
    </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 selected time slot. -->
	<Style x:Key="C1Scheduler_TimeSlotSelected_BrushStyle" TargetType="c1:C1BrushBuilder">
        <Setter Property="DesignColor" Value="{StaticResource C1Scheduler_BaseBackgroundColor}" />
        <Setter Property="DesignBrush" Value="{StaticResource C1Scheduler_TimeSlot_SelectedBrush}" />
	</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="{StaticResource C1Scheduler_BaseBackgroundColor}" />
		<Setter Property="DesignBrush" Value="#FFDBE8F4" />
	</Style>
	<!-- ** End of C1BrushBuilder styles ** -->

    <Style TargetType="c1sched:TimeRuler">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1sched:TimeRuler">
                    <Grid>
                        <ItemsPresenter />
                        <ContentControl x:Name="CurrentTimeIndicator" Visibility="Collapsed"
                            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" 
                            DataContext="{Binding Scheduler}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GroupHeaderButton" TargetType="{x:Type Button}">
        <Setter Property="Height" Value="16" />
        <Setter Property="Width" Value="16" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <c1:C1BrushBuilder x:Name="Background" Style="{StaticResource C1Scheduler_DayHeader_Style}" Input="{TemplateBinding Background}" />
                        <c1:C1BrushBuilder x:Name="MouseOverBrush" Style="{StaticResource C1Scheduler_DayHeader_HoverStyle}" Input="{TemplateBinding Background}" />
                        <Rectangle x:Name="BackgroundElement" Fill="{Binding Output, ElementName=Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="0.5" RadiusX="3" RadiusY="3" />
                        <Rectangle x:Name="MouseOverElement" Fill="{Binding Output, ElementName=MouseOverBrush}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="0.5" RadiusX="3" RadiusY="3" Visibility="Collapsed" />
                        <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- determines the template used for displaying group headers -->
	<DataTemplate x:Key="GroupHeaderTemplate">
		<Grid SnapsToDevicePixels="True">
			<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}" />
			<Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.ColumnSpan="3" BorderThickness="1,0,1,0" BorderBrush="{Binding Output, ElementName=BorderBrush}" Background="{Binding Output, ElementName=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 of the prev button -->
    <Style x:Key="C1Scheduler_PreviousButton_Style" TargetType="Button">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid SnapsToDevicePixels="True">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border BorderThickness="1" CornerRadius="0,0,6,6" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                            <Border x:Name="MouseOverElement" CornerRadius="0,0,6,6" Background="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed" />
                        </Border>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="20" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="30" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Padding="0,3,0,3" Grid.Column="1" Text="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                            <TextBlock Padding="3,0,3,0" Text="&gt;|" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <TextBlock.LayoutTransform>
                                    <RotateTransform Angle="-90" />
                                </TextBlock.LayoutTransform>
                            </TextBlock>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- determines the style of the next button -->
    <Style x:Key="C1Scheduler_NextButton_Style" TargetType="Button">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid SnapsToDevicePixels="True">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border BorderThickness="1" CornerRadius="6,6,0,0" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                            <Border x:Name="MouseOverElement" CornerRadius="6,6,0,0" Background="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed" />
                        </Border>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="20" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="30" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Padding="0,3,0,3" Grid.Column="1" Text="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                            <TextBlock Padding="3,0,3,0" Text="&gt;|" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <TextBlock.LayoutTransform>
                                    <RotateTransform Angle="90" />
                                </TextBlock.LayoutTransform>
                            </TextBlock>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Defines a style for previous/next appointment navigation pane (containing 
		next/previous labels) represented by ContentControl. -->
    <Style x:Key="C1Scheduler_PrevNextAppPane_Style" TargetType="ContentControl">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <Grid SnapsToDevicePixels="True" Visibility="{Binding Scheduler.ShowNavigationPanels, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <c1:C1BrushBuilder x:Name="BackgroundBrush" Style="{StaticResource C1Scheduler_NavPane_Style}" Input="{TemplateBinding Background}" />
                        <c1:C1BrushBuilder x:Name="BorderBrush" Style="{StaticResource C1Scheduler_Border_Style}" Input="{TemplateBinding Background}" />
                        <c1:C1BrushBuilder x:Name="MouseOverBrush" Style="{StaticResource C1Scheduler_NavPane_HoverStyle}" Input="{TemplateBinding Background}" />
                        <Button Grid.Row="1" Grid.Column="0" Content="{Binding Scheduler.PreviousAppointmentText}" CommandTarget="{Binding Scheduler}" CommandParameter="{Binding Owner}" Command="c1sched:C1Scheduler.NavigateToPreviousAppointmentCommand" Background="{Binding Output, ElementName=BackgroundBrush}" BorderBrush="{Binding Output, ElementName=BorderBrush}" Tag="{Binding Output, ElementName=MouseOverBrush}" Foreground="{Binding Scheduler.Foreground}" Style="{DynamicResource C1Scheduler_PreviousButton_Style}">
                            <Button.LayoutTransform>
                                <RotateTransform Angle="-90" />
                            </Button.LayoutTransform>
                        </Button>
                        <Button Grid.Row="1" Grid.Column="2" Content="{Binding Scheduler.NextAppointmentText}" CommandTarget="{Binding Scheduler}" CommandParameter="{Binding Owner}" Command="c1sched:C1Scheduler.NavigateToNextAppointmentCommand" Background="{Binding Output, ElementName=BackgroundBrush}" BorderBrush="{Binding Output, ElementName=BorderBrush}" Tag="{Binding Output, ElementName=MouseOverBrush}" Foreground="{Binding Scheduler.Foreground}" Style="{DynamicResource C1Scheduler_NextButton_Style}">
                            <Button.LayoutTransform>
                                <RotateTransform Angle="-90" />
                            </Button.LayoutTransform>
                        </Button>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Base style for all Office 2007 views. It determines font size and font family -->
    <Style x:Key="BaseViewStyle" TargetType="c1sched:C1Scheduler">
        <Setter Property="FontSize" Value="11" />
        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="Background" Value="{DynamicResource C1Scheduler_Background}" />
        <Setter Property="BorderBrush" Value="{DynamicResource C1Scheduler_Border_Brush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="ControlBackground" Value="{DynamicResource C1Scheduler_ControlArea_Brush}" />
        <Setter Property="ControlForeground" Value="{DynamicResource C1Scheduler_ControlAreaText_Brush}" />
        <Setter Property="Foreground" Value="{DynamicResource C1Scheduler_Foreground_Brush}" />
        <Setter Property="AppointmentForeground" Value="{DynamicResource C1Scheduler_AppointmentForeground_Brush}" />
        <Setter Property="AlternatingBackground" Value="{DynamicResource C1Scheduler_WorkHour_Brush}" />
        <Setter Property="SelectedBackground" Value="{DynamicResource C1Scheduler_Selected_Brush}" />
        <Setter Property="CurrentTimeBrush" Value="{DynamicResource C1Scheduler_Today_Brush}" />
        <Setter Property="TodayBackground" Value="{DynamicResource C1Scheduler_Today_Brush}" />
    </Style>

	<!-- determines the template used for the single time interval of a time ruler in a Day view -->
	<DataTemplate x:Key="C1Scheduler_TimeRuler_Template">
        <Grid>
            <c1sched:TimeRulerHelper Interval="{Binding}" x:Name="helper" />
            <Rectangle Height="1" Margin="0,0,4,0" Width="20" Fill="{Binding Path=Scheduler.ControlForeground}" HorizontalAlignment="Right" VerticalAlignment="Top"/>
            <Grid SnapsToDevicePixels="True" Visibility="{Binding IsZeroMinute, ElementName=helper, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}">
			    <Grid.ColumnDefinitions>
				    <ColumnDefinition Width="30" />
				    <ColumnDefinition MinWidth="25" />
			    </Grid.ColumnDefinitions>
                <Rectangle Height="1" Margin="4,0,4,0" Grid.Column="0" Grid.ColumnSpan="2" Fill="{Binding Path=Scheduler.ControlForeground}" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
                <TextBlock FontSize="16" Grid.Column="0" Foreground="{Binding Path=Scheduler.ControlForeground}" HorizontalAlignment="Right" Padding="3,1,3,0" Text="{Binding Hours, ElementName=helper}" />
			    <TextBlock FontSize="11" Grid.Column="1" Foreground="{Binding Path=Scheduler.ControlForeground}" HorizontalAlignment="Right" Padding="3,2,2,0" Margin="0,0,4,0" Text="{Binding Minutes, ElementName=helper}" />
		    </Grid>
        </Grid>
    </DataTemplate>

    <!-- determines the style of the day group in a day view -->
    <Style TargetType="GroupItem" x:Key="C1Scheduler_DayGroup_Style">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GroupItem">
                    <Grid>
                        <c1:C1BrushBuilder x:Name="BorderBrush" Style="{StaticResource C1Scheduler_Border_Style}" Input="{Binding Path=OwnerGroup.Background}" />
                        <Border BorderThickness="1,0,1,0" x:Name="border" BorderBrush="{Binding ElementName=BorderBrush, Path=Output}">
                            <ItemsPresenter />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsToday}" Value="True">
                            <Setter TargetName="border" Property="BorderBrush" Value="{Binding Path=Scheduler.TodayBackground}" />
                            <Setter TargetName="border" Property="BorderThickness" Value="2,0,2,0" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- determines the style used for the day header button in all views -->
    <Style TargetType="Button" x:Key="C1Scheduler_DayHeaderButton_Style">
        <Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type c1sched:C1Scheduler}}}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="BorderThickness" Value="{DynamicResource C1Scheduler_DayHeaderBorder_Thickness}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <c1:C1BrushBuilder x:Name="BackgroundBrush" Style="{StaticResource C1Scheduler_DayHeader_Style}" Input="{Binding Path=OwnerGroup.Background}" />
                        <c1:C1BrushBuilder x:Name="MouseOverBrush" Style="{StaticResource C1Scheduler_DayHeader_HoverStyle}" Input="{Binding Path=OwnerGroup.Background}" />
                        <Border BorderThickness="{TemplateBinding BorderThickness}" x:Name="DayHeaderBorder" BorderBrush="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" Background="{Binding ElementName=BackgroundBrush, Path=Output}" VerticalAlignment="Stretch">
                            <Rectangle x:Name="MouseOverElement" Fill="{Binding ElementName=MouseOverBrush, Path=Output}" VerticalAlignment="Stretch" Visibility="Collapsed" />
                        </Border>
                        <ContentPresenter Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" TextBlock.Foreground="{TemplateBinding Foreground}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="Center" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsToday}" Value="True">
                            <Setter TargetName="BackgroundBrush" Property="Style" Value="{DynamicResource C1Scheduler_TodayHeader_Style}" />
                            <Setter TargetName="BackgroundBrush" Property="Input" Value="{Binding Scheduler.TodayBackground}" />
                            <Setter TargetName="MouseOverBrush" Property="Style" Value="{StaticResource C1Scheduler_TodayHeader_HoverBrushStyle}" />
                            <Setter TargetName="MouseOverBrush" Property="Input" Value="{Binding Scheduler.TodayBackground}" />
                            <Setter TargetName="DayHeaderBorder" Property="BorderBrush" Value="{Binding Scheduler.TodayBackground}" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

	<!-- 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_WorkSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
					<Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_WorkHourLightBorder_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="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type c1sched:VisualIntervalsPresenter}}}" 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_TopWorkSlot_Style" BasedOn="{StaticResource C1Scheduler_WorkSlot_Style}" TargetType="c1sched:VisualIntervalPresenter">
					<Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_WorkHourBorder_Brush}" />
				</Style>

				<Style x:Key="C1Scheduler_FreeSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
					<Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourLightBorder_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="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type c1sched:VisualIntervalsPresenter}}}" 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_TopFreeSlot_Style" BasedOn="{StaticResource C1Scheduler_FreeSlot_Style}" TargetType="c1sched:VisualIntervalPresenter">
					<Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourBorder_Brush}" />
				</Style>

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

    <!-- determines the style used for displaying All-Day area in a Day view -->
    <Style x:Key="C1Scheduler_AllDayInterval_Style" TargetType="c1sched:VisualIntervalPresenter">
        <Setter Property="BorderThickness" Value="{DynamicResource C1Scheduler_AllDayAreaBorder_Thickness}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1sched:VisualIntervalPresenter">
                    <Grid>
                        <c1:C1BrushBuilder x:Name="BackgroundBrush" Style="{StaticResource C1Scheduler_AllDayArea_Style}" Input="{Binding Path=OwnerGroup.Background}" />
                        <c1:C1BrushBuilder x:Name="SelectedBrush" Style="{StaticResource C1Scheduler_AllDayAreaSelected_Style}" Input="{Binding Path=OwnerGroup.Background}" />
                        <Border x:Name="AllDayBorder" IsHitTestVisible="False" Background="{Binding ElementName=BackgroundBrush, Path=Output}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type c1sched:VisualIntervalGroupsPresenter}}}">
                            <Rectangle Fill="{Binding ElementName=SelectedBrush, Path=Output}" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                        </Border>
                        <Border Background="{Binding Path=VisualIntervals[0].StatusBrush}" Opacity="0.2" Margin="{Binding BorderThickness, ElementName=AllDayBorder}" c1sched:CoverElementsPane.Orientation="Horizontal" c1sched:CoverElementsPane.PaneName="allDayPane" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsToday}" Value="True">
                            <Setter TargetName="AllDayBorder" Property="BorderThickness" Value="{DynamicResource C1Scheduler_AllDayAreaTodayBorder_Thickness}" />
                            <Setter TargetName="AllDayBorder" Property="BorderBrush" Value="{Binding Path=Scheduler.TodayBackground}" />
						</DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Style that represents base One Day View -->
    <Style x:Key="BaseOneDayStyle" TargetType="c1sched:C1Scheduler" BasedOn="{StaticResource BaseViewStyle}">
        <Style.Resources>
            <Style TargetType="{x:Type ListBoxItem}">
                <Setter Property="ListBoxItem.Padding" Value="0" />
            </Style>
        </Style.Resources>
        <Setter Property="c1sched:C1Scheduler.VisualIntervalScale" Value="00:15:00" />
		<Setter Property="ShowWorkTimeOnly" Value="false" />
		<Setter Property="c1sched:C1Scheduler.Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1sched:C1Scheduler">
                    <Border Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ControlBackground}" BorderBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}" BorderThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness}">
                        <Grid SnapsToDevicePixels="True">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <!-- DayHeader grid (includes day headers) -->
                            <Grid Grid.Row="0">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="57" />
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="17" />
                                </Grid.ColumnDefinitions>
								<ItemsControl Grid.Column="1" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=VisibleGroupItems}">
									<ItemsControl.ItemsPanel>
										<ItemsPanelTemplate>
											<UniformGrid Rows="1" />
										</ItemsPanelTemplate>
									</ItemsControl.ItemsPanel>
									<ItemsControl.ItemTemplate>
										<DataTemplate>
											<Grid>
												<Grid.RowDefinitions>
													<RowDefinition Height="Auto" />
													<RowDefinition Height="Auto" />
												</Grid.RowDefinitions>
												<Grid.ColumnDefinitions>
													<ColumnDefinition />
													<ColumnDefinition Width="Auto" />
												</Grid.ColumnDefinitions>
												<!-- Group Header  -->
												<ContentControl Grid.Row="0" Grid.Column="0" MinHeight="25" Visibility="{Binding Path=Scheduler.IsGrouped, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ContentTemplate="{Binding Scheduler.GroupHeaderTemplate}" Content="{Binding}" />
                                                <c1:C1BrushBuilder x:Name="DayHeaderBorderBrush" Style="{StaticResource C1Scheduler_Border_Style}" Input="{Binding Background}" />
                                                <!-- day header list -->
                                                <ItemsControl Grid.Row="1" HorizontalAlignment="Stretch" Focusable="False" Tag="{Binding Output, ElementName=DayHeaderBorderBrush}" ItemsSource="{Binding VisualIntervalGroups}" Background="{Binding Background}">
													<ItemsControl.ItemTemplate>
														<DataTemplate>
															<Button Padding="0,2,0,2" Content="{Binding Converter={x:Static c1sched:VisualIntervalToStringConverter.Default},                     ConverterParameter=DayViewDayHeaderFormat}" Style="{DynamicResource C1Scheduler_DayHeaderButton_Style}" CommandParameter="{Binding Path=Scheduler.OneDayStyle}" Command="c1sched:C1Scheduler.ChangeStyleCommand" />
														</DataTemplate>
													</ItemsControl.ItemTemplate>
													<ItemsControl.ItemsPanel>
														<ItemsPanelTemplate>
															<UniformGrid Rows="1" />
														</ItemsPanelTemplate>
													</ItemsControl.ItemsPanel>
												</ItemsControl>
                                                <Rectangle Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Width="3" IsHitTestVisible="False" Visibility="{Binding Converter={x:Static c1sched:GroupToSeparatorVisibilityConverter.Default}}" />
											</Grid>
										 </DataTemplate>
									</ItemsControl.ItemTemplate>
								</ItemsControl>
							    <Rectangle Grid.Column="2" />
                            </Grid>
                            <!-- AllDay area grid (should scroll vertically) -->
                            <ScrollViewer Grid.Row="1" Height="{Binding AllDayAreaHeight, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="0" Padding="0" Focusable="False" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="57" />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
									<ItemsControl Grid.Column="1" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent},               Path=VisibleGroupItems}">
										<ItemsControl.ItemsPanel>
											<ItemsPanelTemplate>
												<UniformGrid Rows="1" />
											</ItemsPanelTemplate>
										</ItemsControl.ItemsPanel>
										<ItemsControl.ItemTemplate>
											<DataTemplate>
												<Grid>
													<Grid.ColumnDefinitions>
														<ColumnDefinition />
														<ColumnDefinition Width="Auto" />
													</Grid.ColumnDefinitions>
                                                    <c1:C1BrushBuilder x:Name="AllDayBorderBrush" Style="{StaticResource C1Scheduler_Border_Style}" Input="{Binding Background}" />
                                                    <c1sched:VisualIntervalGroupsPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Tag="{Binding Output, ElementName=AllDayBorderBrush}" Background="{Binding Background}" ItemsSource="{Binding VisualIntervalGroups}" ItemContainerStyle="{DynamicResource C1Scheduler_AllDayInterval_Style}">
														<ListBox.ItemsPanel>
															<ItemsPanelTemplate>
																<UniformGrid Rows="1" />
															</ItemsPanelTemplate>
														</ListBox.ItemsPanel>
													</c1sched:VisualIntervalGroupsPresenter>
													<c1sched:AppointmentsCoverPane x:Name="allDayPane" Owner="{Binding Owner}" c1sched:AppointmentsCoverPane.AppointmentFilter="Event" IsDragDropDisabled="{Binding Path=Scheduler.IsDragDropDisabled}" ExtendOnOverflow="True" CoverElementsMargin="10">
														<c1sched:AppointmentsCoverPane.Resources>
															<ResourceDictionary>
																<Thickness x:Key="TimeBorderThickness">0</Thickness>
															</ResourceDictionary>
														</c1sched:AppointmentsCoverPane.Resources>
													</c1sched:AppointmentsCoverPane>
                                                    <Rectangle Grid.Column="1" Width="3" IsHitTestVisible="False" Visibility="{Binding Converter={x:Static c1sched:GroupToSeparatorVisibilityConverter.Default}}" />
												</Grid>
											</DataTemplate>
										</ItemsControl.ItemTemplate>
									</ItemsControl>
                                </Grid>
                            </ScrollViewer>
                            <!-- TimeSlots grid (should scroll vertically) -->
                            <ScrollViewer x:Name="scrollViewer" Grid.Row="2" BorderThickness="0" Padding="0" Focusable="False" MaxHeight="100000" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled">
                                <c1:ScrollViewerTouchBehavior.TouchBehavior>
                                    <c1:ScrollViewerTouchBehavior PanningDirection="Vertical" IgnoreSwipe="True" />
                                </c1:ScrollViewerTouchBehavior.TouchBehavior>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="57" />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <!-- time ruler -->
                                    <c1sched:TimeRuler Grid.Column="0" ItemTemplate="{DynamicResource C1Scheduler_TimeRuler_Template}"
                                           ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=VisibleGroupItems[0].VisualIntervalGroups[0].VisualIntervals}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <UniformGrid Columns="1"/>
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <c1sched:TimeRuler.CurrentTimeTemplate>
                                            <DataTemplate>
                                                <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="2" Margin="8,0,0,0" 
                                                           Fill="{Binding CurrentTimeBrush, RelativeSource={RelativeSource AncestorType={x:Type c1sched:C1Scheduler}}}"/>
                                            </DataTemplate>
                                        </c1sched:TimeRuler.CurrentTimeTemplate>
                                    </c1sched:TimeRuler>
									<ItemsControl Grid.Column="1" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=VisibleGroupItems}">
										<ItemsControl.ItemsPanel>
											<ItemsPanelTemplate>
												<UniformGrid Rows="1" />
											</ItemsPanelTemplate>
										</ItemsControl.ItemsPanel>
										<ItemsControl.ItemTemplate>
											<DataTemplate>
												<Grid>
													<Grid.ColumnDefinitions>
														<ColumnDefinition />
														<ColumnDefinition Width="Auto" />
													</Grid.ColumnDefinitions>
                                                    <c1:C1BrushBuilder x:Name="selectedBackground" Style="{DynamicResource C1Scheduler_TimeSlotSelected_BrushStyle}" Input="{Binding Background}" />
                                                    <c1sched:C1SchedulerPresenter x:Name="presenter" PanningDirection="Vertical" ItemContainerStyleSelector="{DynamicResource TimeSlotStyleSelector}" Background="{Binding Background}" Tag="{Binding Output, ElementName=selectedBackground}" />
													<c1sched:AppointmentsCoverPane x:Name="appPane" Owner="{Binding Owner}" SizingType="Proportional" c1sched:AppointmentsCoverPane.AppointmentFilter="Appointment" IsDragDropDisabled="{Binding Path=Scheduler.IsDragDropDisabled}" CoverElementsMargin="10">
														<c1sched:AppointmentsCoverPane.Resources>
															<ResourceDictionary>
																<Thickness x:Key="TimeBorderThickness">5,0,0,0</Thickness>
															</ResourceDictionary>
														</c1sched:AppointmentsCoverPane.Resources>
													</c1sched:AppointmentsCoverPane>
													<!-- next/previous appointment navigation pane -->
													<Canvas>
														<ContentControl Canvas.Left="0" Canvas.Top="{Binding VerticalOffset, ElementName=scrollViewer}" Width="{Binding ActualWidth, ElementName=presenter}" Height="{Binding ViewportHeight, ElementName=scrollViewer}" Background="{Binding Background}" Style="{DynamicResource C1Scheduler_PrevNextAppPane_Style}" Visibility="{Binding HasVisibleAppointments, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}, ConverterParameter=Invert}" />
													</Canvas>
                                                    <Rectangle Grid.Column="1" Width="3" IsHitTestVisible="False" Visibility="{Binding Converter={x:Static c1sched:GroupToSeparatorVisibilityConverter.Default}}" />
												</Grid>
											</DataTemplate>
										</ItemsControl.ItemTemplate>
									</ItemsControl>
								</Grid>
                            </ScrollViewer>
                            <Rectangle Grid.RowSpan="3" Opacity="0.8" x:Name="DisabledVisual" Stretch="Fill" RadiusX="2" Visibility="{Binding IsEnabled, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}, ConverterParameter=Invert, RelativeSource={RelativeSource TemplatedParent}}" RadiusY="2" StrokeThickness="1" Stroke="{StaticResource DisabledBrush}" Fill="{StaticResource DisabledBrush}" Margin="0,2,0,2" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="c1sched:C1Scheduler.VisualIntervalGroupDescriptions">
            <Setter.Value>
                <c1sched:IntervalGroupDescriptionCollection>
                    <c1sched:VisualIntervalGroupDescription PropertyName="StartTime.Date" />
                </c1sched:IntervalGroupDescriptionCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="VisualIntervalGroupStyles">
            <Setter.Value>
                <c1sched:IntervalGroupStyleCollection>
                    <GroupStyle ContainerStyle="{StaticResource C1Scheduler_DayGroup_Style}">
                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <UniformGrid Rows="1" />
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </c1sched:IntervalGroupStyleCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="c1sched:C1Scheduler.VisualIntervalPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <UniformGrid Columns="1" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="c1sched:C1Scheduler.VisualTimeSpan" Value="1" />
        <Setter Property="c1sched:C1Scheduler.VisualIntervalTemplate">
            <Setter.Value>
                <DataTemplate DataType="{x:Type c1sched:VisualInterval}">
                     <!-- don't place C1BrushBuilder here, it affects performance, use binding to the relative ancestor instead -->
				 	 <Border Background="{Binding Path=StatusBrush}" Opacity="0.2" c1sched:CoverElementsPane.Orientation="Vertical" c1sched:CoverElementsPane.PaneName="appPane" MinHeight="20" />
                 </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Style that represents One Day View -->
    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler},    ResourceId=OneDayStyle}" TargetType="c1sched:C1Scheduler" BasedOn="{StaticResource BaseOneDayStyle}">
    </Style>

    <!-- determines the style of the month grid header (week day names) -->
    <Style x:Key="C1Scheduler_MonthHeader_Style" TargetType="ContentControl">
         <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <Border BorderThickness="0,0,1,0" SnapsToDevicePixels="True" BorderBrush="{TemplateBinding Foreground}">
                        <ContentPresenter Margin="0,2,0,2" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Determines the style used for displaying overflow jumper in a Month View when not all 
       appointment elements fit into available day space. -->
    <Style x:Key="C1Scheduler_OverflowJumper_Style" TargetType="Button">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.9" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Polygon x:Name="arrow" Points="0,0 5,6 10,0" Fill="{TemplateBinding Foreground}" Margin="2" Opacity="0.3">
							<ToolTipService.ToolTip>
								<TextBlock>
									<TextBlock.Text>
										<c1sched:SchedulerLoc Key="MiscStrings:MoreAppointments" DefaultValue="Click for more appointments." />
									</TextBlock.Text>
								</TextBlock>
							</ToolTipService.ToolTip>
						</Polygon>
					</Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

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

	<!-- determines the style used for displaying single day in a Month view -->
    <c1sched:DayIntervalStyleSelector x:Key="MonthDayStyleSelector">
        <c1sched:DayIntervalStyleSelector.Resources>
            <ResourceDictionary>
                <DataTemplate x:Key="DayHeaderTemplate">
                    <Button HorizontalContentAlignment="Stretch" CommandParameter="{Binding Path=Scheduler.OneDayStyle}" Command="c1sched:C1Scheduler.ChangeStyleCommand" BorderThickness="{DynamicResource C1Scheduler_MonthViewDayHeaderBorder_Thickness}" Style="{DynamicResource C1Scheduler_DayHeaderButton_Style}">
                        <DockPanel>
                            <TextBlock DockPanel.Dock="Right" Margin="2" FontWeight="Semibold" Text="{Binding Converter={x:Static c1sched:VisualIntervalToStringConverter.Default}, ConverterParameter=MonthViewDayHeaderDayFormat}" />
                            <TextBlock DockPanel.Dock="Left" x:Name="MonthName" Margin="2,2,0,2" FontWeight="Semibold" Text="{Binding Converter={x:Static c1sched:MonthToStringConverter.Default}}" />
                            <!-- Add empty block to fill panel (it's needed for command) -->
                            <TextBlock />
                        </DockPanel>
                    </Button>
                </DataTemplate>

                <DataTemplate x:Key="VisualIntervalTemplate">
					<Grid Background="{Binding Path=OwnerGroup.Background}">
						<Border Background="{Binding Converter={StaticResource AlternateMonthBrushConverter}}" IsHitTestVisible="False">
                            <Rectangle Fill="{Binding Path=Scheduler.SelectedBackground}" Visibility="{Binding IsSelected, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                        </Border>
                        <Border x:Name="DayContentBorder" c1sched:CoverElementsPane.Orientation="Horizontal" Background="{Binding Path=StatusBrush}" Opacity="0.2" />
                        <Button Name="overflowJumper" HorizontalAlignment="Right" Foreground="{Binding Path=Scheduler.Foreground}" CommandParameter="{Binding Path=Scheduler.OneDayStyle}" Command="c1sched:C1Scheduler.ChangeStyleCommand" VerticalAlignment="Bottom" Visibility="{Binding Path=(c1sched:CoverElementsPane.CoverElementsOverflow),                                 ElementName=DayContentBorder, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" Style="{DynamicResource C1Scheduler_OverflowJumper_Style}" />
                    </Grid>
                </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>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <!-- avoid placing C1BrushBuilder here, use binding to the relative ancestor instead -->
                                    <ContentPresenter Content="{TemplateBinding Content}" Grid.Row="0" ContentTemplate="{StaticResource DayHeaderTemplate}" />
                                    <Border BorderThickness="{TemplateBinding BorderThickness}" Grid.Row="1" BorderBrush="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type c1sched:VisualIntervalsPresenter}}}">
                                             <!-- 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>
                                </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>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <ContentPresenter Content="{TemplateBinding Content}" Grid.Row="0" ContentTemplate="{StaticResource DayHeaderTemplate}" />
                                    <Border Grid.Row="1" BorderThickness="2,1,2,2" BorderBrush="{Binding Path=Scheduler.TodayBackground}">
                                        <!-- 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>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ResourceDictionary>
        </c1sched:DayIntervalStyleSelector.Resources>
    </c1sched:DayIntervalStyleSelector>

    <!-- determines the style of the week tab in a Month view -->
    <Style x:Key="C1Scheduler_WeekTab_Style" TargetType="Button">
        <Setter Property="FontWeight" Value="ExtraLight" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <c1:C1BrushBuilder x:Name="BackgroundBrush" Style="{StaticResource C1Scheduler_WeekTab_BrushStyle}" Input="{Binding Path=OwnerGroup.Background}" />
                        <c1:C1BrushBuilder x:Name="MouseOverBrush" Style="{StaticResource C1Scheduler_WeekTab_HoverBrushStyle}" Input="{Binding Path=OwnerGroup.Background}" />
                        <Border BorderThickness="0.75" BorderBrush="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type c1sched:VisualIntervalsPresenter}}}" Background="{Binding ElementName=BackgroundBrush, Path=Output}">
                            <Rectangle x:Name="MouseOverElement" Fill="{Binding ElementName=MouseOverBrush, Path=Output}" Visibility="Collapsed" />
                        </Border>
                        <ContentPresenter Content="{TemplateBinding Content}" Margin="0.75" TextBlock.Foreground="{Binding Path=Scheduler.Foreground}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Style that represents the base Month View -->
    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler},    ResourceId=MonthStyle}" TargetType="c1sched:C1Scheduler" BasedOn="{StaticResource BaseViewStyle}">
        <Setter Property="c1sched:C1Scheduler.VisualTimeSpan" Value="35" />
        <Setter Property="c1sched:C1Scheduler.VisualIntervalScale" Value="1" />
        <Setter Property="SmallStartTimeChange" Value="7" />
        <Setter Property="c1sched:C1Scheduler.Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1sched:C1Scheduler">
					<Border BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="True" BorderThickness="{TemplateBinding BorderThickness}" Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ControlBackground}">
						<Grid>
							<Grid.ColumnDefinitions>
								<ColumnDefinition />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>
							<ItemsControl Grid.Column="0" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=VisibleGroupItems}">
								<ItemsControl.ItemsPanel>
									<ItemsPanelTemplate>
										<UniformGrid Rows="1" />
									</ItemsPanelTemplate>
								</ItemsControl.ItemsPanel>
								<ItemsControl.ItemTemplate>
									<DataTemplate>
										<Grid>
											<c1:C1BrushBuilder x:Name="background" Style="{DynamicResource C1Scheduler_ControlAreaDark_BrushStyle}" Input="{Binding Background}" />
                                            <c1:C1BrushBuilder x:Name="BorderBrush" Style="{StaticResource C1Scheduler_Border_Style}" Input="{Binding Background}" />
											<Grid>
												<Grid.RowDefinitions>
													<RowDefinition Height="Auto" />
													<RowDefinition Height="Auto" />
													<RowDefinition />
												</Grid.RowDefinitions>
												<Grid.ColumnDefinitions>
													<ColumnDefinition Width="Auto" />
													<ColumnDefinition />
													<ColumnDefinition Width="Auto" />
												</Grid.ColumnDefinitions>
												<!-- Group Header  -->
												<ContentControl Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" MinHeight="25" Visibility="{Binding Path=Scheduler.IsGrouped, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ContentTemplate="{Binding Scheduler.GroupHeaderTemplate}" Content="{Binding}" />
												<c1:C1BrushBuilder x:Name="ForegroundBrush" DesignBrush="{Binding Path=Scheduler.ControlForeground}" Style="{DynamicResource C1Scheduler_MonthHeaderForeground_BrushStyle}" Input="{Binding Background}" />
												<!-- Outlook 2007 week days -->
												<Rectangle Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Fill="{Binding Output, ElementName=background}" />
												<Border Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" BorderBrush="{Binding ElementName=BorderBrush, Path=Output}" BorderThickness="1 1 0 0" Visibility="{Binding Path=Scheduler.IsGrouped, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                                                <!-- week headers -->
												<UniformGrid Grid.Column="1" Grid.Row="1" Rows="1" Columns="7">
													<ContentControl Style="{DynamicResource C1Scheduler_MonthHeader_Style}" Foreground="{Binding Output, ElementName=ForegroundBrush}" Content="{Binding Path=VisualIntervals[0],                 Converter={x:Static c1sched:VisualIntervalToStringConverter.Default},                 ConverterParameter=MonthViewHeaderFormat}" />
													<ContentControl Style="{DynamicResource C1Scheduler_MonthHeader_Style}" Foreground="{Binding Output, ElementName=ForegroundBrush}" Content="{Binding Path=VisualIntervals[1],                 Converter={x:Static c1sched:VisualIntervalToStringConverter.Default},                 ConverterParameter=MonthViewHeaderFormat}" />
													<ContentControl Style="{DynamicResource C1Scheduler_MonthHeader_Style}" Foreground="{Binding Output, ElementName=ForegroundBrush}" Content="{Binding Path=VisualIntervals[2],                  Converter={x:Static c1sched:VisualIntervalToStringConverter.Default},                 ConverterParameter=MonthViewHeaderFormat}" />
													<ContentControl Style="{DynamicResource C1Scheduler_MonthHeader_Style}" Foreground="{Binding Output, ElementName=ForegroundBrush}" Content="{Binding Path=VisualIntervals[3],                  Converter={x:Static c1sched:VisualIntervalToStringConverter.Default},                 ConverterParameter=MonthViewHeaderFormat}" />
													<ContentControl Style="{DynamicResource C1Scheduler_MonthHeader_Style}" Foreground="{Binding Output, ElementName=ForegroundBrush}" Content="{Binding Path=VisualIntervals[4],                  Converter={x:Static c1sched:VisualIntervalToStringConverter.Default},                 ConverterParameter=MonthViewHeaderFormat}" />
													<ContentControl Style="{DynamicResource C1Scheduler_MonthHeader_Style}" Foreground="{Binding Output, ElementName=ForegroundBrush}" Content="{Binding Path=VisualIntervals[5],                  Converter={x:Static c1sched:VisualIntervalToStringConverter.Default},                 ConverterParameter=MonthViewHeaderFormat}" />
													<ContentControl Style="{DynamicResource C1Scheduler_MonthHeader_Style}" Foreground="{Binding Output, ElementName=ForegroundBrush}" Content="{Binding Path=VisualIntervals[6],                  Converter={x:Static c1sched:VisualIntervalToStringConverter.Default},                 ConverterParameter=MonthViewHeaderFormat}" />
												</UniformGrid>
                                                <!-- week tabs area -->
												<Border Width="25" Grid.Column="0" Grid.Row="2" Grid.RowSpan="2" BorderBrush="{Binding ElementName=BorderBrush, Path=Output}" BorderThickness="0 0 1 0" Background="{Binding Output, ElementName=background}" />
                                                <Border Grid.Column="0" Grid.Row="2" Grid.RowSpan="2" BorderBrush="{Binding ElementName=BorderBrush, Path=Output}" Visibility="{Binding Path=Scheduler.IsGrouped, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" BorderThickness="1 0 1 0" />
												<c1sched:C1SchedulerPresenter Background="{Binding Background}" PanningDirection="Vertical" Tag="{Binding ElementName=BorderBrush, Path=Output}" Grid.Column="1" Grid.Row="2" Margin="-18,0,0,0" ItemContainerStyleSelector="{DynamicResource MonthDayStyleSelector}" />
												<c1sched:AppointmentsCoverPane Grid.Column="1" Grid.Row="2" Owner="{Binding Owner}" c1sched:AppointmentsCoverPane.KeepTimesAtDrop="True" IsDragDropDisabled="{Binding Path=Scheduler.IsDragDropDisabled}" CoverElementsMargin="10">
													<c1sched:AppointmentsCoverPane.Resources>
														<ResourceDictionary>
															<Thickness x:Key="TimeBorderThickness">0</Thickness>
														</ResourceDictionary>
													</c1sched:AppointmentsCoverPane.Resources>
												</c1sched:AppointmentsCoverPane>
												<!-- next/previous appointment navigation pane -->
												<ContentControl Grid.Column="1" Grid.Row="2" Background="{Binding Background}" Style="{DynamicResource C1Scheduler_PrevNextAppPane_Style}" Visibility="{Binding HasVisibleAppointments, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}, ConverterParameter=Invert}" />
                                                <Rectangle Fill="{Binding Path=Scheduler.ControlBackground}" Width="3" IsHitTestVisible="False" Visibility="{Binding Converter={x:Static c1sched:GroupToSeparatorVisibilityConverter.Default}}" Grid.Column="2" Grid.Row="0" Grid.RowSpan="3" />
											</Grid>
										</Grid>
									</DataTemplate>
								</ItemsControl.ItemTemplate>
							</ItemsControl>
							<ScrollBar x:Name="PART_C1SchedulerScrollBar" Grid.Column="1" Margin="0,25,0,0" Orientation="Vertical" />
                            <Rectangle Grid.ColumnSpan="2" Opacity="0.8" x:Name="DisabledVisual" Stretch="Fill" RadiusX="2" Visibility="{Binding IsEnabled, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}, ConverterParameter=Invert, RelativeSource={RelativeSource TemplatedParent}}" RadiusY="2" StrokeThickness="1" Stroke="{StaticResource DisabledBrush}" Fill="{StaticResource DisabledBrush}" Margin="0,2,0,2" />
                        </Grid>
					</Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VisualIntervalGroupDescriptions">
            <Setter.Value>
                <c1sched:IntervalGroupDescriptionCollection>
                    <c1sched:VisualIntervalGroupDescription PropertyName="StartTimeInfo.WeekOfYearFullWeek" />
                </c1sched:IntervalGroupDescriptionCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="c1sched:C1Scheduler.VisualIntervalGroupStyles">
            <Setter.Value>
                <c1sched:IntervalGroupStyleCollection>
                    <GroupStyle>
                        <!-- Week row -->
                        <GroupStyle.ContainerStyle>
                            <Style TargetType="GroupItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="GroupItem">
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="18" />
                                                    <ColumnDefinition />
                                                </Grid.ColumnDefinitions>
												<c1:C1BrushBuilder x:Name="background" Style="{DynamicResource C1Scheduler_ControlAreaDark_BrushStyle}" Input="{Binding OwnerGroup.Background}" />
												<DockPanel>
                                                    <Border DockPanel.Dock="Top" BorderThickness="0,0,0.5,0" Grid.Column="0" IsHitTestVisible="False" Background="{Binding Output, ElementName=background}" BorderBrush="{Binding OwnerGroup.Background}">
                                                        <TextBlock Margin="0,2,0,3" Text=" " />
                                                    </Border>
                                                    <Border VerticalAlignment="Stretch" Background="{Binding OwnerGroup.Background}">
                                                        <ContentPresenter />
                                                    </Border>
                                                </DockPanel>
                                                <ItemsPresenter Grid.Column="1" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </GroupStyle.ContainerStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <Border Background="{Binding OwnerGroup.Background}">
                                    <Button Style="{DynamicResource C1Scheduler_WeekTab_Style}" MinHeight="18" CommandParameter="{Binding Path=Scheduler.WeekStyle}" Command="c1sched:C1Scheduler.ChangeStyleCommand">
                                        <Button.LayoutTransform>
                                            <RotateTransform Angle="-90" />
                                        </Button.LayoutTransform>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Path=StartTime,                                                                            Converter={x:Static c1sched:DateTimeToStringConverter.Default},                                                     ConverterParameter=MMMd, Mode=OneTime}" />
                                            <TextBlock Text=" - " />
                                            <TextBlock Text="{Binding Path=InclusiveEndTime,                                                      Converter={x:Static c1sched:DateTimeToStringConverter.Default},                                                     ConverterParameter=MMMd, Mode=OneTime}" />
                                        </StackPanel>
                                    </Button>
                                </Border>
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>
                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <UniformGrid Columns="1" />
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </c1sched:IntervalGroupStyleCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="c1sched:C1Scheduler.VisualIntervalPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <UniformGrid Rows="1" Columns="7" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler},    ResourceId=WeekStyle}" TargetType="c1sched:C1Scheduler" BasedOn="{StaticResource {ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler},    ResourceId=OneDayStyle}}">
        <Setter Property="VisualTimeSpan" Value="7" />
		<Setter Property="c1sched:C1Scheduler.VisualIntervalScale" Value="00:30:00" />
	</Style>

    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler},    ResourceId=WorkingWeekStyle}" TargetType="c1sched:C1Scheduler" BasedOn="{StaticResource {ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler},    ResourceId= OneDayStyle}}">
		<Setter Property="VisualTimeSpan" Value="7" />
		<Setter Property="c1sched:C1Scheduler.VisualIntervalScale" Value="00:30:00" />
	</Style>

    <!-- Default style for System.Windows.Controls.ScrollViewer -->
    <Style TargetType="ScrollViewer" x:Key="ScheduleGroupItemScrollViewerStyle">
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalScrollBarVisibility" Value="Visible" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollViewer">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid Background="{TemplateBinding Background}">
                            <ScrollContentPresenter x:Name="ScrollContentPresenter" Cursor="{TemplateBinding Cursor}" Margin="0,0,3,0" ContentTemplate="{TemplateBinding ContentTemplate}" />
                            <c1sched:ShiftingCanvas SkipScrollViewers="1" HorizontalContentAlignment="Right" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                <ScrollBar x:Name="PART_VerticalScrollBar" Width="18" VerticalAlignment="Stretch" Opacity="0.85" IsTabStop="False" Orientation="Vertical" Height="{TemplateBinding ViewportHeight}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{TemplateBinding VerticalOffset}" Margin="0,-1,-1,-1" />
                            </c1sched:ShiftingCanvas>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Determines the template used for the horizontal time ruler in the TimeLine view -->
    <DataTemplate x:Key="C1Scheduler_HorizontalTimeRuler_Template">
        <Border BorderBrush="{Binding Path=Scheduler.ControlForeground}" BorderThickness="0,0,2,0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ItemsControl Grid.Row="0" Height="35" IsHitTestVisible="False" IsTabStop="False" Focusable="False"
                              ItemsSource="{Binding VisualIntervals}" Visibility="{Binding Path=Scheduler.VisualIntervalScale, Converter={x:Static c1sched:TimeRulerVisibilityConverter.Default}}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Grid Height="34">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25" />
                                    <RowDefinition Height="10" />
                                </Grid.RowDefinitions>
                                <c1sched:TimeRulerHelper Interval="{Binding}" x:Name="helper" />
                                <Rectangle Width="1" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Stretch" Fill="{Binding Path=Scheduler.ControlForeground}" />
                                <Rectangle Width="1" HorizontalAlignment="Left" Grid.Row="0" Height="12" Visibility="{Binding IsZeroMinute, ElementName=helper, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" Fill="{Binding Path=Scheduler.ControlForeground}" VerticalAlignment="Bottom" />
                                <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.RowSpan="2" VerticalAlignment="Top" Margin="6,0,6,5" Visibility="{Binding IsZeroMinute, ElementName=helper, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" >
                                    <TextBlock FontSize="16" Foreground="{Binding Path=Scheduler.ControlForeground}" Text="{Binding Hours, ElementName=helper}" />
                                    <TextBlock FontSize="11" Foreground="{Binding Path=Scheduler.ControlForeground}" Padding="2" Text="{Binding Minutes, ElementName=helper}" />
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <UniformGrid Rows="1" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
                <Border BorderThickness="0,2,0,0" Height="22" Grid.Row="1" BorderBrush="{Binding Path=Scheduler.ControlForeground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <c1sched:ShiftingCanvas>
                        <TextBlock Foreground="{Binding Path=Scheduler.ControlForeground}" Padding="4,2,2,2" Text="{Binding Converter={x:Static c1sched:VisualIntervalToStringConverter.Default}, ConverterParameter=D}" />
                    </c1sched:ShiftingCanvas>
                </Border>
            </Grid>
        </Border>
    </DataTemplate>

    <!-- Determines the style used for displaying time slots in the TimeLine view availability status line.
         Copy it into every theme, as using DynamicResource here affects performance -->
    <c1sched:TimeSlotStyleSelector x:Key="AvailabilityStatusStyleSelector">
        <c1sched:TimeSlotStyleSelector.Resources>
            <ResourceDictionary>
                <Style x:Key="C1Scheduler_WorkSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_WorkHourLightBorder_Brush}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="c1sched:VisualIntervalPresenter">
                                <!-- Background="{Binding Path=Scheduler.AlternatingBackground}"-->
                                <Border x:Name="IntervalBorder" IsHitTestVisible="False" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderThickness="1,0,0,0" BorderBrush="{TemplateBinding BorderBrush}">
                                    <Rectangle Fill="{Binding Path=TotalStatusBrush}" Margin="-1,7,0,7" />
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

                <Style x:Key="C1Scheduler_TopWorkSlot_Style" BasedOn="{StaticResource C1Scheduler_WorkSlot_Style}" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_WorkHourBorder_Brush}" />
                </Style>

                <Style x:Key="C1Scheduler_FreeSlot_Style" BasedOn="{StaticResource C1Scheduler_WorkSlot_Style}" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourLightBorder_Brush}" />
                </Style>

                <Style x:Key="C1Scheduler_TopFreeSlot_Style" BasedOn="{StaticResource C1Scheduler_WorkSlot_Style}" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourBorder_Brush}" />
                </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_WorkHourLightBorder_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="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type c1sched:VisualIntervalsPresenter}}}" 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">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_WorkHourBorder_Brush}" />
                </Style>

                <Style x:Key="C1Scheduler_FreeSlot_Style" TargetType="c1sched:VisualIntervalPresenter">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourLightBorder_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="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type c1sched:VisualIntervalsPresenter}}}" 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">
                    <Setter Property="BorderBrush" Value="{StaticResource C1Scheduler_FreeHourBorder_Brush}" />
                </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_ControlArea_BrushStyle}" Input="{Binding Background}" />
            <c1:C1BrushBuilder x:Name="BorderBrush" Style="{StaticResource C1Scheduler_MonthHeaderForeground_BrushStyle}" Input="{Binding Background}" />
            <Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderThickness="4,1,0,1" BorderBrush="{Binding Output, ElementName=BorderBrush}" 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 that represents TimeLine View -->
    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler},    ResourceId=TimeLineStyle}" TargetType="c1sched:C1Scheduler" BasedOn="{StaticResource BaseViewStyle}">
        <Style.Resources>
            <Style TargetType="{x:Type ListBoxItem}">
                <Setter Property="ListBoxItem.Padding" Value="0" />
            </Style>
        </Style.Resources>
        <Setter Property="c1sched:C1Scheduler.VisualIntervalScale" Value="00:30:00" />
        <Setter Property="ShowWorkTimeOnly" Value="false" />
        <Setter Property="IsTotalGroupItemEnabled" Value="true" />
        <Setter Property="GroupHeaderTemplate" Value="{DynamicResource TimeLineGroupHeaderTemplate}" />
        <Setter Property="c1sched:C1Scheduler.Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1sched:C1Scheduler">
                    <Border Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ControlBackground}" BorderBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}" BorderThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness}" SnapsToDevicePixels="True">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                                <RowDefinition Height="17" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="8" />
                                <ColumnDefinition MinWidth="50" Width="100" MaxWidth="300" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <StackPanel Grid.Row="0" Grid.Column="0">
                                <Rectangle Height="35" Visibility="{Binding VisualIntervalScale, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static c1sched:TimeRulerVisibilityConverter.Default}}" />
                                <Rectangle Height="22" />
                            </StackPanel>
                            <Rectangle Grid.Row="1" Height="32" Visibility="{Binding Path=IsTotalGroupItemEnabled, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                            <!-- group headers -->
                            <ItemsControl Grid.Column="1" Grid.Row="2" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=VisibleGroupItems}" ItemTemplate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=GroupHeaderTemplate}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <UniformGrid Columns="1" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                            <GridSplitter Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ControlForeground}" Width="3" Grid.Column="2" Grid.Row="0" Grid.RowSpan="4" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
                            <!-- TimeSlots grid (should scroll horizontally) -->
                            <ScrollViewer x:Name="scrollViewer" Grid.Row="0" Grid.RowSpan="4" Grid.Column="3" BorderThickness="0" Padding="0" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Visible">
                                <c1:ScrollViewerTouchBehavior.TouchBehavior>
                                    <c1:ScrollViewerTouchBehavior PanningDirection="Horizontal" IgnoreSwipe="True" />
                                </c1:ScrollViewerTouchBehavior.TouchBehavior>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <!-- time line -->
                                    <c1sched:TimeRuler Grid.Row="0" Margin="0,0,3,0" ItemTemplate="{DynamicResource C1Scheduler_HorizontalTimeRuler_Template}"
                                           ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=VisibleGroupItems[0].VisualIntervalGroups}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <UniformGrid Rows="1"/>
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <c1sched:TimeRuler.CurrentTimeTemplate>
                                            <DataTemplate>
                                                <Rectangle HorizontalAlignment="Center" VerticalAlignment="Stretch" Width="2" Margin="0,6,0,0" 
                                                           Fill="{Binding CurrentTimeBrush, RelativeSource={RelativeSource AncestorType={x:Type c1sched:C1Scheduler}}}"/>
                                            </DataTemplate>
                                        </c1sched:TimeRuler.CurrentTimeTemplate>
                                    </c1sched:TimeRuler>
                                    <!-- availability status line (DataContext is C1Scheduler.TotalGroupItem) -->
                                    <c1sched:C1SchedulerPresenter BorderThickness="0,2,0,1" Grid.Row="1" Margin="0,0,3,0" Height="32" BorderBrush="{Binding Path=ControlForeground, RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=IsTotalGroupItemEnabled, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" DataContext="{Binding Path=TotalGroupItem, RelativeSource={RelativeSource TemplatedParent}}" ItemContainerStyleSelector="{DynamicResource AvailabilityStatusStyleSelector}" />
                                    <!-- time slots -->
                                    <ItemsControl Grid.Row="2" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent},               Path=VisibleGroupItems}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <UniformGrid Columns="1" />
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <ScrollViewer x:Name="row" BorderThickness="0,1,0,1" BorderBrush="{Binding Output, ElementName=BorderBrush}" Style="{StaticResource ScheduleGroupItemScrollViewerStyle}" VerticalScrollBarVisibility="Auto">
                                                    <Grid MinHeight="57">
                                                        <c1:C1BrushBuilder x:Name="BorderBrush" Style="{DynamicResource C1Scheduler_MonthHeaderForeground_BrushStyle}" Input="{Binding Background}" />
                                                        <c1:C1BrushBuilder x:Name="selectedBackground" Style="{DynamicResource C1Scheduler_TimeSlotSelected_BrushStyle}" Input="{Binding Background}" />
                                                        <c1sched:C1SchedulerPresenter PanningDirection="Horizontal" ItemContainerStyleSelector="{DynamicResource HorizontalTimeSlotStyleSelector}" Tag="{Binding Output, ElementName=selectedBackground}" Background="{Binding Background}" />
                                                        <c1sched:AppointmentsCoverPane x:Name="appPane" Owner="{Binding Owner}" c1sched:AppointmentsCoverPane.AppointmentFilter="All" ExtendOnOverflow="True" SizingType="ExtendedSingle" IsDragDropDisabled="{Binding Path=Scheduler.IsDragDropDisabled}" CoverElementsMargin="12">
                                                            <c1sched:AppointmentsCoverPane.Resources>
                                                                <ResourceDictionary>
                                                                    <Thickness x:Key="TimeBorderThickness">5,0,0,0</Thickness>
                                                                </ResourceDictionary>
                                                            </c1sched:AppointmentsCoverPane.Resources>
                                                        </c1sched:AppointmentsCoverPane>
                                                    </Grid>
                                                </ScrollViewer>
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                    </ItemsControl>
                                </Grid>
                            </ScrollViewer>
                            <!-- ScrollBar for group navigation -->
                            <ScrollBar x:Name="PART_GroupNavigationScrollBar" Grid.Column="4" Grid.Row="2" Orientation="Vertical" Visibility="{Binding IsGrouped, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" />
                            <Rectangle Grid.RowSpan="4" Grid.ColumnSpan="5" Opacity="0.8" x:Name="DisabledVisual" Stretch="Fill" RadiusX="2" Visibility="{Binding IsEnabled, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}, ConverterParameter=Invert, RelativeSource={RelativeSource TemplatedParent}}" RadiusY="2" StrokeThickness="1" Stroke="{StaticResource DisabledBrush}" Fill="{StaticResource DisabledBrush}" Margin="0,2,0,2" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="c1sched:C1Scheduler.VisualIntervalGroupDescriptions">
            <Setter.Value>
                <c1sched:IntervalGroupDescriptionCollection>
                    <c1sched:VisualIntervalGroupDescription PropertyName="StartTime.Date" />
                </c1sched:IntervalGroupDescriptionCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="VisualIntervalGroupStyles">
            <Setter.Value>
                <c1sched:IntervalGroupStyleCollection>
                    <GroupStyle>
                        <GroupStyle.ContainerStyle>
                            <Style TargetType="GroupItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="GroupItem">
                                            <Border BorderThickness="0,0,2,0" BorderBrush="{Binding Path=Scheduler.ControlForeground}">
                                                <ItemsPresenter />
                                            </Border>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </GroupStyle.ContainerStyle>
                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <UniformGrid Rows="1" />
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </c1sched:IntervalGroupStyleCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="c1sched:C1Scheduler.VisualIntervalPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <UniformGrid Rows="1" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="c1sched:C1Scheduler.VisualTimeSpan" Value="1" />
        <Setter Property="c1sched:C1Scheduler.VisualIntervalTemplate">
            <Setter.Value>
                <DataTemplate DataType="{x:Type c1sched:VisualInterval}">
                    <!-- don't place C1BrushBuilder here, it affects performance, use binding to the relative ancestor instead -->
                    <Border MinWidth="55" Background="Transparent" c1sched:CoverElementsPane.Orientation="Horizontal" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>