MESCIUS InputMan for WPF 3.0J
TextBox.xaml

TextBox.xaml では、テキストコントロールの外観を定義します。

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

TextBox.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">
  
  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Themes/Generic/Common.xaml"/>
    <ResourceDictionary Source="/Themes/Generic/Base.xaml"/>
  </ResourceDictionary.MergedDictionaries>

  <Style TargetType="{x:Type im:GcTextBox}" BasedOn="{StaticResource EditBaseStyle}" x:Key="GcTextBox_StyleKey">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type im:GcTextBox}">
          <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
              BorderThickness="{TemplateBinding BorderThickness}" FlowDirection="{TemplateBinding FrameworkElement.FlowDirection}">
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledBorder" Storyboard.TargetProperty="Opacity" To="1"/>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>

            <Grid>
              <Rectangle x:Name="DisabledBorder" Fill="{TemplateBinding DisabledBackground}" StrokeThickness="0" IsHitTestVisible="False" Opacity="0"/>
              <im:EditorPresenter x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
            </Grid>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="im:GcTextBox" BasedOn="{StaticResource GcTextBox_StyleKey}"/>
</ResourceDictionary>
関連トピック

 

 


© MESCIUS inc. All rights reserved.