Calendar.xaml |
Calendar.xaml では、ドロップダウンカレンダーコントロールの外観を定義します。
Calendar.xaml の内容は以下のとおりです。
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:im="clr-namespace:GrapeCity.Windows.InputMan;assembly=GrapeCity.WPF.InputMan" xmlns:imp="clr-namespace:GrapeCity.Windows.InputMan.Primitives;assembly=GrapeCity.WPF.InputMan" xmlns:sys="clr-namespace:System;assembly=mscorlib"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Themes/Generic/Common.xaml"/> </ResourceDictionary.MergedDictionaries> <SolidColorBrush x:Key="GcCalendar_DisabledForegroundBrush" Color="#FFADADAD"/> <SolidColorBrush x:Key="TodayBackgroundBrushKey" Color="#FFAAAAAA"/> <SolidColorBrush x:Key="TodayForegroundBrushKey" Color="#FFFFFFFF"/> <SolidColorBrush x:Key="CalendarSelectionBackgroundBrushKey" Color="#FF0A246A"/> <LinearGradientBrush x:Key="GcCalendar_GenericBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFA3AEB9" Offset="0"/> <GradientStop Color="#FF8399A9" Offset="0.375"/> <GradientStop Color="#FF718597" Offset="0.375"/> <GradientStop Color="#FF617584" Offset="1"/> </LinearGradientBrush> <Style TargetType="{x:Type im:GcDropDownCalendar}" x:Key="GcDropDownCalendar_StyleKey"> <Setter Property="BorderBrush" Value="{StaticResource GcCalendar_GenericBorderBrush}"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Background" Value="White"/> <Setter Property="Foreground" Value="Black"/> <Setter Property="Padding" Value="2"/> <Setter Property="CalendarSelectionBackground" Value="{StaticResource CalendarSelectionBackgroundBrushKey}"/> <Setter Property="TodayBackground" Value="{StaticResource TodayBackgroundBrushKey}"/> <Setter Property="TodayForeground" Value="{StaticResource TodayForegroundBrushKey}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type im:GcDropDownCalendar}"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="1"> <imp:CalendarItem InnerMargin="{TemplateBinding InnerMargin}" Margin="{TemplateBinding Padding}"/> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="im:GcDropDownCalendar" BasedOn="{StaticResource GcDropDownCalendar_StyleKey}"/> <LinearGradientBrush x:Key="HeaderBackgroundBrushKey" StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#FFE4EAF0" Offset="0"/> <GradientStop Color="#FFECF0F4" Offset="1"/> </LinearGradientBrush> <SolidColorBrush x:Key="HeaderForegroundBrushKey" Color="Black"/> <ControlTemplate x:Key="PreviousButtonTemplate" TargetType="imp:CalendarHeaderButton"> <Grid Background="{TemplateBinding Background}"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"/> <VisualState x:Name="MouseOver"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Fill" Duration="0" > <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <SolidColorBrush Color="#FF73A9D8"/> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Disabled"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Fill" Duration="0" > <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource GcCalendar_DisabledForegroundBrush}"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Path x:Name="buttonContent" Height="10" Width="6" Fill="{TemplateBinding Foreground}" Data="M288.75,232.25 L288.75,240.625 L283,236.625 z" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </ControlTemplate> <ControlTemplate x:Key="NextButtonTemplate" TargetType="imp:CalendarHeaderButton"> <Grid Background="{TemplateBinding Background}"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"/> <VisualState x:Name="MouseOver"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Fill" Duration="0" > <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <SolidColorBrush Color="#FF73A9D8"/> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Disabled"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Fill" Duration="0" > <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource GcCalendar_DisabledForegroundBrush}"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Path x:Name="buttonContent" Height="10" Width="6" Fill="{TemplateBinding Foreground}" Data="M282.875,231.875 L282.875,240.375 L288.625,236 z" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </ControlTemplate> <DataTemplate DataType="{x:Type imp:HeaderInfo}"> <TextBlock Text="{Binding Text}" TextWrapping="NoWrap" HorizontalAlignment="Center" VerticalAlignment="Center"/> </DataTemplate> <Style TargetType="{x:Type imp:CalendarItem}" x:Key="CalendarItem_StyleKey"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type imp:CalendarItem}"> <Grid Name="PART_Root" Background="{TemplateBinding Background}" Margin="{TemplateBinding Padding}"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="DisplayModeStates"> <VisualState x:Name="Month"> <Storyboard> <DoubleAnimation Storyboard.TargetName="PART_MonthView" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0"/> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_MonthView" Storyboard.TargetProperty="IsHitTestVisible" Duration="0"> <ObjectAnimationUsingKeyFrames.KeyFrames> <DiscreteObjectKeyFrame KeyTime="0" > <DiscreteObjectKeyFrame.Value> <sys:Boolean>True</sys:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> <DoubleAnimation Storyboard.TargetName="PART_YearView" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0"/> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_YearView" Storyboard.TargetProperty="IsHitTestVisible" Duration="0"> <ObjectAnimationUsingKeyFrames.KeyFrames> <DiscreteObjectKeyFrame KeyTime="0" > <DiscreteObjectKeyFrame.Value> <sys:Boolean>False</sys:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Year"> <Storyboard > <DoubleAnimation Storyboard.TargetName="PART_MonthView" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0"/> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_MonthView" Storyboard.TargetProperty="IsHitTestVisible" Duration="0"> <ObjectAnimationUsingKeyFrames.KeyFrames> <DiscreteObjectKeyFrame KeyTime="0" > <DiscreteObjectKeyFrame.Value> <sys:Boolean>False</sys:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> <DoubleAnimation Storyboard.TargetName="PART_YearView" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0"/> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_YearView" Storyboard.TargetProperty="IsHitTestVisible" Duration="0"> <ObjectAnimationUsingKeyFrames.KeyFrames> <DiscreteObjectKeyFrame KeyTime="0" > <DiscreteObjectKeyFrame.Value> <sys:Boolean>True</sys:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Decade"> <Storyboard> <DoubleAnimation Storyboard.TargetName="PART_MonthView" Storyboard.TargetProperty="Opacity" To="0.0" Duration="0"/> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_MonthView" Storyboard.TargetProperty="IsHitTestVisible" Duration="0"> <ObjectAnimationUsingKeyFrames.KeyFrames> <DiscreteObjectKeyFrame KeyTime="0" > <DiscreteObjectKeyFrame.Value> <sys:Boolean>False</sys:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> <DoubleAnimation Storyboard.TargetName="PART_YearView" Storyboard.TargetProperty="Opacity" To="1.0" Duration="0"/> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_YearView" Storyboard.TargetProperty="IsHitTestVisible" Duration="0"> <ObjectAnimationUsingKeyFrames.KeyFrames> <DiscreteObjectKeyFrame KeyTime="0" > <DiscreteObjectKeyFrame.Value> <sys:Boolean>True</sys:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition /> <ColumnDefinition Width="auto"/> </Grid.ColumnDefinitions> <Rectangle Grid.ColumnSpan="3" Fill="{StaticResource HeaderBackgroundBrushKey}"/> <imp:CalendarHeaderButton x:Name="PreviousButton" Grid.Row="0" Grid.Column="0" Width="30" HorizontalAlignment="Left" Template="{StaticResource PreviousButtonTemplate}" Command="im:CalendarCommands.MoveToPrevious"> </imp:CalendarHeaderButton> <imp:CalendarHeaderButton Grid.Row="0" Grid.Column="1" Content="{Binding Path=HeaderInfo, RelativeSource={RelativeSource TemplatedParent}}" Command="im:CalendarCommands.ZoomOut"/> <imp:CalendarHeaderButton Grid.Row="0" Grid.Column="2" Width="30" HorizontalAlignment="Right" Template="{StaticResource NextButtonTemplate}" Command="im:CalendarCommands.MoveToNext"/> <Grid Grid.Row="1" Grid.ColumnSpan="3" x:Name="PART_MonthView" Margin="{TemplateBinding InnerMargin}"> <Grid.RowDefinitions> <RowDefinition Height="auto" /> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto" /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> </Grid> <Grid Grid.Row="1" Grid.ColumnSpan="3" x:Name="PART_YearView" Opacity="0" Margin="{TemplateBinding InnerMargin}"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="imp:CalendarItem" BasedOn="{StaticResource CalendarItem_StyleKey}"/> </ResourceDictionary>