<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c1sched="using:C1.Xaml.Schedule">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ms-appx:///C1.UWP.Schedule/themes/Common.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="markStyle" TargetType="Image">
        <Setter Property="Margin" Value="1" />
        <Setter Property="Height" Value="14" />
        <Setter Property="Width" Value="14" />
    </Style>

    <Style TargetType="c1sched:IntervalAppointmentPresenter">
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="MinHeight" Value="32"/>
        <Setter Property="LabelBrush" Value="Transparent"/>
        <Setter Property="MinWidth" Value="32" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1sched:IntervalAppointmentPresenter">
                    <Grid UseLayoutRounding="True" Margin="{TemplateBinding Margin}" Background="{Binding LabelBrush, RelativeSource={RelativeSource TemplatedParent}}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PointerOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <c1sched:AppointmentWrapPanel x:Name="PART_AppointmentWrapPanel" Grid.Column="0" DockLastChildToEnd="true" Orientation="Horizontal" Margin="2,0,2,0">
                            <TextBlock x:Name="time" Margin="0,0,2,0"
                                    Text="{Binding Appointment.Start, Converter={StaticResource DateTimeToStringConverter}, ConverterParameter=t, RelativeSource={RelativeSource TemplatedParent}}" 
                                    Visibility="{Binding ShowTime, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <TextBlock x:Name="Subject" FontWeight="SemiBold" Margin="0,0,2,0" 
                                    TextWrapping="{Binding TextWrapping, RelativeSource={RelativeSource TemplatedParent}}"
                                    Text="{Binding Appointment.Subject, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <TextBlock x:Name="location" TextWrapping="{Binding TextWrapping, RelativeSource={RelativeSource TemplatedParent}}"
                                    Text="{Binding Appointment.Location, RelativeSource={RelativeSource TemplatedParent}}" />
                            <StackPanel x:Name="images" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0" VerticalAlignment="Bottom">
                                <TextBlock Text="&#xe1f6;" FontFamily="Segoe UI Symbol" FontSize="14" VerticalAlignment="Center"
                                        Visibility="{Binding Appointment.Private, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
                                <TextBlock Text="&#xe117;" FontFamily="Segoe UI Symbol" FontSize="14" VerticalAlignment="Center"
                                        Visibility="{Binding IsOccurrence, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
                                <Path Data="M1.4142134,0 L3.9334826,2.5192692 L4.0138712,2.457062 C5.3551784,1.4413851 7.0266347,0.83883858 8.8388233,0.83883846 C10.892637,0.83883858 12.765689,1.6127758 14.182241,2.8849177 L14.239887,2.9377837 L16.838831,0.33883855 L16.838831,7.3388386 L16.697823,7.3388386 L14.649805,7.3388391 L9.8388329,7.3388386 L12.823691,4.3539801 L12.672725,4.2233081 C11.633069,3.3587661 10.296663,2.8388386 8.8388224,2.8388386 C7.5524926,2.8388386 6.3607054,3.2436264 5.383894,3.9327707 L5.3626285,3.9484148 L13.728736,12.314523 L13.793825,12.223356 C14.154083,11.696948 14.432639,11.11021 14.611223,10.481412 L14.649804,10.338839 L16.697823,10.338839 L16.676311,10.451118 C16.43154,11.647285 15.919806,12.746209 15.206079,13.682918 L15.158385,13.744172 L17.677668,16.263456 L16.263456,17.67767 L14.849244,16.263458 L13.744178,15.158397 L13.663775,15.220615 C12.322469,16.236292 10.651012,16.838839 8.8388233,16.838839 C6.7850099,16.838839 4.9119587,16.064901 3.495405,14.792759 L3.4377692,14.739902 L0.83883184,17.338839 L0.83883184,10.33884 L0.97982335,10.338839 L3.0278409,10.338839 L7.8388319,10.33884 L4.8539648,13.323707 L5.00492,13.454369 C6.0445762,14.318911 7.3809814,14.838839 8.8388224,14.838839 C10.125153,14.838839 11.31694,14.434051 12.293752,13.744906 L12.315032,13.729251 L3.9489195,5.3631387 L3.8838205,5.4543209 C3.5235617,5.9807291 3.2450054,6.5674672 3.0664215,7.1962652 L3.0278409,7.3388391 L0.97982335,7.3388391 L1.0013356,7.2265596 C1.2461076,6.0303917 1.7578418,4.931468 2.4715686,3.9947596 L2.519273,3.9334922 L1.4142122,2.8284314 L0,1.4142135 z" 
                                        Fill="{TemplateBinding Foreground}" Stretch="Uniform" Height="18" Width="18"
                                        Visibility="{Binding IsException, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </StackPanel>
                        </c1sched:AppointmentWrapPanel>
                        <Rectangle x:Name="PointerOverElement" IsHitTestVisible="False" Visibility="Collapsed" Fill="#22FFFFFF" 
                            Opacity="{ThemeResource TextControlPointerOverBorderThemeOpacity}" />
                        <Rectangle StrokeThickness="2" Stroke="{ThemeResource AppointmentBorderThemeBrush}" 
                            Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Key="IntervalAppointmentTemplate">
        <c1sched:IntervalAppointmentPresenter Margin="1" IntervalAppointment="{Binding}"
            Foreground="{Binding Interval.Scheduler.AppointmentForeground}"
            IsReadOnly="{Binding Interval.Scheduler.IsInPlaceEditingDisabled}" />
    </DataTemplate>
    
    <Style TargetType="c1sched:CoverElementChunk">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1sched:CoverElementChunk">
                    <ContentPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
