<Window x:Class="CustomUIElements.Window1" BorderThickness="0" BorderBrush="#FF000000" Title="Custom UI Elements" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:c1sched="http://schemas.componentone.com/winfx/2006/xaml">

	<Window.Resources>
		<SolidColorBrush x:Key="commandBaseBorderBrush" Color="#FF6593CF" />
		
		<!-- custom interval appointment template -->
		<LinearGradientBrush x:Key="defaultGradBrash" StartPoint="0,0" EndPoint="0,1">
			<GradientStop Color="#FFFFFFFF" Offset="0" />
			<GradientStop Color="#BBFFFFFF" Offset="1" />
		</LinearGradientBrush>

		<DataTemplate x:Key="customIntervalAppointmentTemplate">
			<DataTemplate.Resources>
				<Style x:Key="markStyle" TargetType="{x:Type Image}">
					<Setter Property="Margin" Value="1" />
					<Setter Property="Height" Value="14" />
					<Setter Property="Width" Value="14" />
				</Style>
				<Style x:Key="looklessTextBox" TargetType="{x:Type TextBox}">
					<Setter Property="BorderBrush" Value="Transparent" />
					<Setter Property="BorderThickness" Value="0" />
					<Setter Property="HorizontalScrollBarVisibility" Value="Disabled" />
					<Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
					<Setter Property="Background" Value="Transparent" />
					<Setter Property="Foreground" Value="{Binding Path=Foreground, RelativeSource={RelativeSource         AncestorType={x:Type c1sched:C1Scheduler}}}" />
					<Setter Property="Margin" Value="0" />
					<Setter Property="Padding" Value="0" />
				</Style>
			</DataTemplate.Resources>
			<c1sched:PilePanel>
				<c1sched:PilePanel.InputBindings>
					<MouseBinding MouseAction="LeftDoubleClick" Command="c1sched:C1Scheduler.EditAppointmentDialogCommand" />
				</c1sched:PilePanel.InputBindings>
				<c1sched:PropertyBridge Name="showTimeThickness" Source="{DynamicResource TimeBorderThickness}" />
				<Border x:Name="brd" CornerRadius="8,0,8,0" Background="{Binding Appointment.Label.Color,       Converter={x:Static c1sched:ColorToBrushConverter.Default}}" />
				<Border x:Name="gradBorder" BorderBrush="{Binding Appointment.Label.Color,       Converter={x:Static c1sched:ColorToBrushConverter.Default}}" BorderThickness="2px" Background="{Binding Path=Interval.Scheduler.Theme[C1Scheduler_AppointmentBgMask_Brush]}" CornerRadius="8,0,8,0">
					<DockPanel ClipToBounds="True">
						<Border Name="leftInnerShowTimeBorder" DockPanel.Dock="Left" Width="{Binding Target.Left, ElementName=showTimeThickness}" Background="{Binding Appointment.BusyStatus.Brush.Brush}" BorderBrush="Black" BorderThickness="0,0,1px,0" CornerRadius="8,0,0,0" />
						<!-- If background is not specified, MouseDown event doesn't work for empty areas -->
						<c1sched:AppointmentWrapPanel Background="Transparent" Margin="2,0,2,0" DockLastChildToEnd="True" Orientation="Horizontal" x:Name="appointmentWrapPanel" IsReadOnly="{Binding Path=Interval.Scheduler.IsInPlaceEditingDisabled}">
							<c1sched:AppointmentWrapPanel.ToolTip>
								<ToolTip>
									<WrapPanel Orientation="Vertical">
										<TextBlock Text="{Binding Appointment.Start,           Converter={x:Static c1sched:DateTimeToStringConverter.Default},           ConverterParameter=HH:mm}" Margin="2,0,2,0" />
									<TextBlock FontWeight="Bold" Text="{Binding Appointment.Subject}" Margin="2,0,2,0" TextWrapping="Wrap" />
									<TextBlock TextWrapping="Wrap" Text="{Binding Appointment.Location}" />
								</WrapPanel>
								</ToolTip>
							</c1sched:AppointmentWrapPanel.ToolTip>
							<TextBlock x:Name="time" Text="{Binding Appointment.Start,         Converter={x:Static c1sched:DateTimeToStringConverter.Default},         ConverterParameter=HH:mm}" Margin="0,0,2,0" />
							<!-- Shows subject when appointment is inactive -->
							<TextBlock x:Name="Subject" Text="{Binding Appointment.Subject}" FontWeight="SemiBold" TextWrapping="Wrap" />
							<!-- Visible while in-place editing only (look at triggers) -->
							<TextBox x:Name="PART_Subject" Style="{StaticResource looklessTextBox}" MaxLength="255" Text="{Binding Appointment.Subject}" FontWeight="SemiBold" TextWrapping="Wrap" />
							<TextBlock x:Name="location" TextWrapping="Wrap" Text="{Binding Appointment.Location}" />
							<StackPanel Orientation="Horizontal">
								<Image Visibility="Collapsed" DockPanel.Dock="Right" Name="recurrenceMark" Style="{StaticResource markStyle}">
									<Image.Source>
										<BitmapImage CacheOption="OnDemand" UriSource="/C1.WPF.Schedule.4;component/Resources/Voccurrence.png" />
									</Image.Source>
								</Image>
								<Image Visibility="Collapsed" DockPanel.Dock="Right" Name="exceptionMark" Style="{StaticResource markStyle}">
									<Image.Source>
										<BitmapImage CacheOption="OnDemand" UriSource="/C1.WPF.Schedule.4;component/Resources/Vexception.png" />
									</Image.Source>
								</Image>
								<Image Visibility="Collapsed" DockPanel.Dock="Right" Name="privateMark" Style="{StaticResource markStyle}">
									<Image.Source>
										<BitmapImage CacheOption="OnDemand" UriSource="/C1.WPF.Schedule.4;component/Resources/Vkey.png" />
									</Image.Source>
								</Image>
							</StackPanel>
						</c1sched:AppointmentWrapPanel>
					</DockPanel>
				</Border>
			</c1sched:PilePanel>
			<DataTemplate.Triggers>
				<DataTrigger Binding="{Binding Appointment.Label.Color}" Value="White">
					<Setter TargetName="brd" Property="Background" Value="{Binding Interval.Scheduler.Background}" />
					<Setter TargetName="gradBorder" Property="BorderBrush" Value="{Binding Interval.Scheduler.Background}" />
					<Setter TargetName="gradBorder" Property="Background" Value="{StaticResource defaultGradBrash}" />
				</DataTrigger>
				<DataTrigger Binding="{Binding IsSelectedAppointment}" Value="True">
					<Setter TargetName="gradBorder" Property="BorderBrush" Value="Black" /> 
				</DataTrigger>
				<!-- hide TextBlock while in-place editing -->
				<Trigger SourceName="PART_Subject" Property="IsFocused" Value="True">
					<Setter TargetName="Subject" Property="Visibility" Value="Collapsed" />
				</Trigger>
				<!-- hide PART_Subject if it is not focused -->
				<Trigger SourceName="PART_Subject" Property="IsFocused" Value="False">
					<Setter TargetName="PART_Subject" Property="Visibility" Value="Collapsed" />
				</Trigger>
				<Trigger SourceName="Subject" Property="Visibility" Value="Visible">
					<Setter TargetName="PART_Subject" Property="Visibility" Value="Collapsed" />
				</Trigger>
				<Trigger SourceName="appointmentWrapPanel" Property="IsKeyboardFocusWithin" Value="True">
					<Setter TargetName="location" Property="Visibility" Value="Collapsed" />
				</Trigger>
				<MultiDataTrigger>
					<MultiDataTrigger.Conditions>
						<Condition Binding="{Binding Appointment.RecurrenceState}" Value="Occurrence" />
						<Condition Binding="{Binding IsKeyboardFocusWithin, ElementName=appointmentWrapPanel}" Value="False" />
					</MultiDataTrigger.Conditions>
					<Setter TargetName="recurrenceMark" Property="Visibility" Value="Visible" />
				</MultiDataTrigger>
				<MultiDataTrigger>
					<MultiDataTrigger.Conditions>
						<Condition Binding="{Binding Appointment.RecurrenceState}" Value="Exception" />
						<Condition Binding="{Binding IsKeyboardFocusWithin, ElementName=appointmentWrapPanel}" Value="False" />
					</MultiDataTrigger.Conditions>
					<Setter TargetName="exceptionMark" Property="Visibility" Value="Visible" />
				</MultiDataTrigger>
				<MultiDataTrigger>
					<MultiDataTrigger.Conditions>
						<Condition Binding="{Binding Appointment.Private}" Value="True" />
						<Condition Binding="{Binding IsKeyboardFocusWithin, ElementName=appointmentWrapPanel}" Value="False" />
					</MultiDataTrigger.Conditions>
					<Setter TargetName="privateMark" Property="Visibility" Value="Visible" />
				</MultiDataTrigger>
				<DataTrigger Binding="{Binding Appointment.AllDayEvent}" Value="true">
					<Setter TargetName="time" Property="Text" Value=" " />
				</DataTrigger>
				<DataTrigger Binding="{Binding Appointment.Location.Length}" Value="0">
					<Setter TargetName="location" Property="Visibility" Value="Collapsed" />
				</DataTrigger>
			</DataTemplate.Triggers>
		</DataTemplate>
		<!-- end of custom interval appointment template -->
	</Window.Resources>
	
	<Grid SnapsToDevicePixels="True" Margin="0,-1,0,0">
		<Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="192" />
			<ColumnDefinition Width="Auto" />
			<ColumnDefinition />
		</Grid.ColumnDefinitions>
        <ToolBar Grid.Row="0" Grid.ColumnSpan="3">
            <RadioButton x:Name="btnDay" Content="Day" CommandTarget="{Binding ElementName=Scheduler}" Command="c1sched:C1Scheduler.ChangeStyleCommand" CommandParameter="{Binding Path=OneDayStyle, ElementName=Scheduler}" />
            <RadioButton x:Name="btnWorkWeek" Content="Work Week" CommandTarget="{Binding ElementName=Scheduler}" Command="c1sched:C1Scheduler.ChangeStyleCommand" CommandParameter="{Binding Path=WorkingWeekStyle, ElementName=Scheduler}" />
            <RadioButton x:Name="btnWeek" Content="Week" CommandTarget="{Binding ElementName=Scheduler}" Command="c1sched:C1Scheduler.ChangeStyleCommand" CommandParameter="{Binding Path=WeekStyle, ElementName=Scheduler}" />
            <RadioButton x:Name="btnMonth" Content="Month" CommandTarget="{Binding ElementName=Scheduler}" Command="c1sched:C1Scheduler.ChangeStyleCommand" CommandParameter="{Binding Path=MonthStyle, ElementName=Scheduler}" />
            <RadioButton x:Name="btnTimeLine" Content="Time Line" CommandTarget="{Binding ElementName=Scheduler}" Command="c1sched:C1Scheduler.ChangeStyleCommand" CommandParameter="{Binding Path=TimeLineStyle, ElementName=Scheduler}" />
        </ToolBar>

        <c1sched:C1Scheduler Name="Scheduler" Grid.Column="2" Grid.Row="1" IntervalAppointmentTemplate="{DynamicResource customIntervalAppointmentTemplate}" Theme="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1sched:C1Scheduler, ResourceId=Office2007.Default}}" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1sched:C1Scheduler, ResourceId=WeekStyle}}">
			<c1sched:C1Scheduler.Resources>
				<!-- determines the template used for one hour of a time ruler in a Day view -->
				<DataTemplate x:Key="C1Scheduler_TimeRuler_Template">
					<Grid Name="OneHourGrid" Background="Black">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="30" />
							<ColumnDefinition MinWidth="20" SharedSizeGroup="Minutes" />
						</Grid.ColumnDefinitions>
						<c1sched:TimeRulerHelper Interval="{Binding}" x:Name="helper" />
						<Border BorderThickness="0,1px,0,0" Margin="4,0,0,0" Grid.Column="0" SnapsToDevicePixels="True" Visibility="{Binding IsZeroMinute, ElementName=helper, Converter={x:Static c1sched:BooleanToVisibilityConverter.Default}}" BorderBrush="White" HorizontalAlignment="Right" VerticalAlignment="Top" MinWidth="25">
							<TextBlock Text="{Binding StartTime.Hour}" FontSize="18" FontFamily="Segoe UI" Foreground="White" HorizontalAlignment="Right" Padding="3,0,3,0" />
						</Border>
						<Border BorderThickness="0,1px,0,0" Grid.Column="1" Margin="0,0,4,0" SnapsToDevicePixels="True" BorderBrush="White" />
						<TextBlock FontSize="11" Grid.Column="1" Text="{Binding Minutes, ElementName=helper}" Foreground="White" HorizontalAlignment="Right" Padding="3,2,2,0" Margin="0,0,4,0">
						</TextBlock>
					</Grid>
				</DataTemplate>
			</c1sched:C1Scheduler.Resources>
		</c1sched:C1Scheduler>

		<c1sched:C1Calendar Name="Calendar" VerticalAlignment="Stretch" Grid.Row="1" Grid.Column="0" MaxSelectionCount="42" CalendarHelper="{Binding ElementName=Scheduler, Path=CalendarHelper, Mode=OneWay}" SelectedDates="{Binding ElementName=Scheduler, Path=VisibleDates, Mode=OneWay}" BoldedDates="{Binding ElementName=Scheduler, Path=BoldedDates, Mode=OneWay}" GenerateAdjacentMonthDays="true">
		</c1sched:C1Calendar>

        <Border Grid.Column="1" Width="4" Grid.Row="1" BorderBrush="{StaticResource commandBaseBorderBrush}">

		</Border>

	</Grid>
</Window>