MESCIUS InputMan for WPF 3.0J
Date.xaml

Date.xaml では、日付コントロールの外観を定義します。

Date.xaml の内容は以下のとおりです。

Date.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:if="clr-namespace:GrapeCity.Windows.InputMan.Fields;assembly=GrapeCity.WPF.InputMan">

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Themes/Generic/Common.xaml"/>
    <ResourceDictionary Source="/Themes/Generic/Base.xaml"/>
    <ResourceDictionary Source="/Themes/Generic/SideButton.xaml"/>
  </ResourceDictionary.MergedDictionaries>

  <Style TargetType="{x:Type im:GcDateTime}" BasedOn="{StaticResource FieldsEditorControlStyle}" x:Key="GcDateTime_StyleKey">
    <Style.Setters>      
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type im:GcDateTime}">
            <Border Background="{TemplateBinding Panel.Background}"
                  BorderBrush="{TemplateBinding Control.BorderBrush}"
                  BorderThickness="{TemplateBinding Control.BorderThickness}"
                  FlowDirection="{TemplateBinding FrameworkElement.FlowDirection}"
                  Name="Bd"
                  SnapsToDevicePixels="True">
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                  <VisualState x:Name="Normal"/>
                  <VisualState x:Name="Disabled">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DisabledBackground">
                        <DiscreteObjectKeyFrame KeyTime="0">
                          <DiscreteObjectKeyFrame.Value>
                            <Visibility>Visible</Visibility>
                          </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="SpinButtonStates">
                  <VisualState x:Name="SpinButtonVisible">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="SpinButtonPanel">
                        <DiscreteObjectKeyFrame KeyTime="0">
                          <DiscreteObjectKeyFrame.Value>
                            <Visibility>Visible</Visibility>
                          </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="SpinButtonCollapsed"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DropDownButtonStates">
                  <VisualState x:Name="DropDownButtonVisible"/>
                  <VisualState x:Name="DropDownButtonCollapsed">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DropDownButton">
                        <DiscreteObjectKeyFrame KeyTime="0">
                          <DiscreteObjectKeyFrame.Value>
                            <Visibility>Collapsed</Visibility>
                          </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
              
              <Grid Name="Placement"
                  SnapsToDevicePixels="true">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*"/>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Rectangle Grid.ColumnSpan="3" x:Name="DisabledBackground" IsHitTestVisible="False" Fill="{TemplateBinding DisabledBackground}" StrokeThickness="0" Visibility="Collapsed"/>
                
                <imp:DropDownWindow x:Name="PART_Popup"
                     Style="{TemplateBinding DropDownWindowStyle}"
                     TargetElementValue="{Binding Path=Value, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                     Grid.ColumnSpan="2"
                     IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}">
                  <Border x:Name="PART_ResizeHolder" Background="White" BorderThickness="1" BorderBrush="Black">
                    <im:GcDropDownCalendar x:Name="PART_DropDownChild" CalendarYear="Normal" SelectionMode="SingleDate" ShowContextMenu="False"  BorderBrush="{x:Null}" BorderThickness="0"
                                 FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
                                 IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
                                 MaxDate="{TemplateBinding MaxDate}"
                                 MinDate="{TemplateBinding MinDate}"
                                 SelectedDate="{Binding ElementName=PART_Popup, Path=DropDownValue, Mode=TwoWay}"/>
                  </Border>
                </imp:DropDownWindow>
                <im:FieldsPresenter x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
                <Grid Grid.Column="1" x:Name="SpinButtonPanel" SnapsToDevicePixels="True" Visibility="Collapsed" Margin="0,1,1,1">
                  <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                  </Grid.RowDefinitions>
                  <imp:SpinButton Command="im:FieldsEditingCommands.SpinUp" Content="{StaticResource UpArrowGeometry}"/>
                  <imp:SpinButton Command="im:FieldsEditingCommands.SpinDown" Content="{StaticResource DownArrowGeometry}" Grid.Row="1"/>
                </Grid>
                <imp:DropDownButton x:Name="DropDownButton" Grid.Column="2"
                        IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"/>
              </Grid>
            </Border>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
      <Setter Property="ControlValidatorSet" Value=""/>
    </Style.Setters>
  </Style>
  <Style TargetType="im:GcDateTime" BasedOn="{StaticResource GcDateTime_StyleKey}"/>
  <Style TargetType="{x:Type if:DateEraField}" BasedOn="{StaticResource DropdownFieldSytle}"/>
  <Style TargetType="{x:Type if:DateEraYearField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateYearField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateMonthField}" BasedOn="{StaticResource DropdownFieldSytle}"/>
  <Style TargetType="{x:Type if:DateDayField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateHourField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateShortHourField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateAmPmField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateMinuteField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateSecondField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateLiteralField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:DateEraDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateEraYearDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateADDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateYearDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateMonthDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateDayDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateWeekdayDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateHourDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateShortHourDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateAmPmDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateMinuteDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateSecondDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateSystemFormatDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
  <Style TargetType="{x:Type if:DateLiteralDisplayField}" BasedOn="{StaticResource DisplayFieldStyle}"/>
</ResourceDictionary>
関連トピック

 

 


© MESCIUS inc. All rights reserved.