MESCIUS InputMan for WPF 3.0J
Mask.xaml

Mask.xaml では、マスクコントロールの外観を定義します。

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

Mask.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:if="clr-namespace:GrapeCity.Windows.InputMan.Fields;assembly=GrapeCity.WPF.InputMan"
  xmlns:imp="clr-namespace:GrapeCity.Windows.InputMan.Primitives;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:GcMask}" BasedOn="{StaticResource FieldsEditorControlStyle}" x:Key="GcMask_StyleKey">
    <Style.Setters>            
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type im:GcMask}">
            <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>
                      <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledBackground" Storyboard.TargetProperty="Opacity" To="1"/>
                    </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>
              </VisualStateManager.VisualStateGroups>
              
              <Grid Name="Placement"
                  SnapsToDevicePixels="true">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*"/>
                  <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                
                <Rectangle Grid.ColumnSpan="2" x:Name="DisabledBackground" IsHitTestVisible="False" Fill="{TemplateBinding DisabledBackground}" StrokeThickness="0" Opacity="0"/>
                <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>
              </Grid>
            </Border>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style.Setters>
  </Style>
  <Style TargetType="im:GcMask" BasedOn="{StaticResource GcMask_StyleKey}"/>
  <Style TargetType="{x:Type if:MaskPatternField}" BasedOn="{StaticResource FieldStyle}"/>
  <Style TargetType="{x:Type if:MaskEnumerationField}" BasedOn="{StaticResource DropdownFieldSytle}"/>
  <Style TargetType="{x:Type if:MaskLiteralField}" BasedOn="{StaticResource FieldStyle}"/>
</ResourceDictionary>
関連トピック

 

 


© MESCIUS inc. All rights reserved.