<UserControl x:Class="TaskIt.Modules.Tasks.Views.Calendar"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:telerikScheduler="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Scheduler" 
    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    xmlns:Infrastructure="clr-namespace:TaskIt.Infrastructure;assembly=TaskIt.Infrastructure" 
    xmlns:telerikDragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
    mc:Ignorable="d"
    d:DesignHeight="800" d:DesignWidth="600">

    <UserControl.Resources>
        <Infrastructure:DataContextProxy x:Key="DataContextProxy"/>
        <DataTemplate x:Key="AppointmentTemplate">
            <Grid>
                <Grid Background="Transparent" DataContext="{Binding ViewModel, Source={StaticResource DataContextProxy}}">
                    <telerikNavigation:RadContextMenu.ContextMenu>
                        <telerikNavigation:RadContextMenu Opened="CalendarContextMenuOpened">
                            <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandEdit}" Icon="{Binding IconEdit}" Command="{Binding EditCommand}"/>
                            <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandDelete}" Icon="{Binding IconDelete}" Command="{Binding DeleteCommand}" CommandParameter="{Binding SelectedItem, Mode=TwoWay}"/>
                            <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandMarkCompleted}" Icon="{Binding IconMarkCompleted}" Command="{Binding MarkCompletedCommand}"/>
                            <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandMoveTo}" Visibility="{Binding IsMoveToCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}">
                                <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandMoveToInbox}" Icon="{Binding IconInbox}" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryInbox}" Visibility="{Binding IsMoveToInboxCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandMoveToActions}" Icon="{Binding IconActions}" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryActions}" Visibility="{Binding IsMoveToActionsCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandMoveToWaiting}" Icon="{Binding IconWaiting}" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryWaiting}" Visibility="{Binding IsMoveToWaitingCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandMoveToSomeday}" Icon="{Binding IconSomeday}" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategorySomeday}" Visibility="{Binding IsMoveToSomedayCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandMoveToTicklers}" Icon="{Binding IconTicklers}" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryTicklers}" Visibility="{Binding IsMoveToTicklersCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandMoveToReference}" Icon="{Binding IconReference}" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryReference}" Visibility="{Binding IsMoveToReferenceCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                            </telerikNavigation:RadMenuItem>
                            <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandSendTo}" Visibility="{Binding IsSendToCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}">
                                <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandSendToTwitter}" Icon="{Binding IconTwitter}" Command="{Binding SendToTwitterCommand}"/>
                                <telerikNavigation:RadMenuItem Header="{Binding ResourceCommandSendToFacebook}" Icon="{Binding IconFacebook}" Command="{Binding SendToFacebookCommand}"/>
                            </telerikNavigation:RadMenuItem>
                        </telerikNavigation:RadContextMenu>
                    </telerikNavigation:RadContextMenu.ContextMenu>
                </Grid>
                <TextBox x:Name="PART_SubjectTextBox" Text="{Binding Path=Occurrence.Appointment.Subject}" Style="{StaticResource AppointmentTextBox}" telerikDragDrop:RadDragAndDropManager.AllowDrag="True"/>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>

    <telerik:RadDockPanel>
        <StackPanel Style="{StaticResource SchedulerLegendContainerStyle}" telerik:RadDockPanel.Dock="Bottom">
            <Border Style="{StaticResource SchedulerLegendItemOuterBorderStyle}">
                <Border BorderBrush="{StaticResource InboxBorderBrush}" Background="{StaticResource InboxBrush}" Style="{StaticResource SchedulerLegendItemInnerBorderStyle}"/>
            </Border>
            <TextBlock Text="Inbox" Style="{StaticResource SchedulerLegendItemTextStyle}"/>
            <Rectangle Style="{StaticResource SchedulerLegendItemSpacerStyle}"/>
            <Border Style="{StaticResource SchedulerLegendItemOuterBorderStyle}">
                <Border BorderBrush="{StaticResource ActionsBorderBrush}" Background="{StaticResource ActionsBrush}" Style="{StaticResource SchedulerLegendItemInnerBorderStyle}"/>
            </Border>
            <TextBlock Text="Actions" Style="{StaticResource SchedulerLegendItemTextStyle}"/>
            <Rectangle Style="{StaticResource SchedulerLegendItemSpacerStyle}"/>
            <Border Style="{StaticResource SchedulerLegendItemOuterBorderStyle}">
                <Border BorderBrush="{StaticResource WaitingBorderBrush}" Background="{StaticResource WaitingBrush}" Style="{StaticResource SchedulerLegendItemInnerBorderStyle}"/>
            </Border>
            <TextBlock Text="Waiting" Style="{StaticResource SchedulerLegendItemTextStyle}"/>
            <Rectangle Style="{StaticResource SchedulerLegendItemSpacerStyle}"/>
            <Border Style="{StaticResource SchedulerLegendItemOuterBorderStyle}">
                <Border BorderBrush="{StaticResource SomedayBorderBrush}" Background="{StaticResource SomedayBrush}" Style="{StaticResource SchedulerLegendItemInnerBorderStyle}"/>
            </Border>
            <TextBlock Text="Someday" Style="{StaticResource SchedulerLegendItemTextStyle}"/>
            <Rectangle Style="{StaticResource SchedulerLegendItemSpacerStyle}"/>
            <Border Style="{StaticResource SchedulerLegendItemOuterBorderStyle}">
                <Border BorderBrush="{StaticResource TicklersBorderBrush}" Background="{StaticResource TicklersBrush}" Style="{StaticResource SchedulerLegendItemInnerBorderStyle}"/>
            </Border>
            <TextBlock Text="Ticklers" Style="{StaticResource SchedulerLegendItemTextStyle}"/>
            <Rectangle Style="{StaticResource SchedulerLegendItemSpacerStyle}"/>
            <Border Style="{StaticResource SchedulerLegendItemOuterBorderStyle}">
                <Border BorderBrush="{StaticResource ReferenceBorderBrush}" Background="{StaticResource ReferenceBrush}" Style="{StaticResource SchedulerLegendItemInnerBorderStyle}"/>
            </Border>
            <TextBlock Text="Reference" Style="{StaticResource SchedulerLegendItemTextStyle}"/>
        </StackPanel>
        <telerikScheduler:RadScheduler x:Name="schCalendar"  AppointmentsSource="{Binding CalendarTasks}" SelectedAppointment="{Binding SelectedCalendarItem, Mode=TwoWay}" ViewMode="Timeline" IsViewModeNavigationEnabled="False" MonthViewScrollBarVisibility="Collapsed" telerik:RadDockPanel.Dock="Top"
            OpenModalDialogs="True" AppointmentTemplate="{StaticResource AppointmentTemplate}" telerikDragDrop:RadDragAndDropManager.AllowDrag="True"/>
    </telerik:RadDockPanel>
</UserControl>
