MESCIUS InputMan for WPF 3.0J
Base.xaml

Base.xaml では、各コントロール共通の要素およびそれぞれのコントロールの外観を定義します。

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

Base.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"
  xmlns:ifp="clr-namespace:GrapeCity.Windows.InputMan.Fields.Primitives;assembly=GrapeCity.WPF.InputMan">

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Themes/Generic/Common.xaml"/>
  </ResourceDictionary.MergedDictionaries>
  
  <ControlTemplate x:Key="FieldsEditorControlTemplate" TargetType="{x:Type imp:FieldsEditorControl}">
    <Border Background="{TemplateBinding Panel.Background}"
        BorderBrush="{TemplateBinding Control.BorderBrush}"
        BorderThickness="{TemplateBinding Control.BorderThickness}"
        FlowDirection="{TemplateBinding FrameworkElement.FlowDirection}"
        Name="Bd"
        SnapsToDevicePixels="True">
      <im:FieldsPresenter x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
    </Border>
  </ControlTemplate>

  <ControlTemplate x:Key="FieldTemplate" TargetType="{x:Type ifp:Field}">
    <Border Background="{TemplateBinding Panel.Background}"
        BorderBrush="{TemplateBinding Control.BorderBrush}"
        BorderThickness="{TemplateBinding Control.BorderThickness}"
        Padding="{TemplateBinding Control.Padding}"
        Name="Bd"
        SnapsToDevicePixels="True">
      <if:FieldContentPresenter
        x:Name="PART_ContentHost"
        SnapsToDevicePixels="True"
        HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
        VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"/>
    </Border>
  </ControlTemplate>
  <ControlTemplate x:Key="DropDownFieldTemplate" TargetType="{x:Type ifp:Field}">
    <Border Background="{TemplateBinding Panel.Background}"
        BorderBrush="{TemplateBinding Border.BorderBrush}"
        BorderThickness="{TemplateBinding Border.BorderThickness}"        
        Name="Bd" 
        SnapsToDevicePixels="True">
      <Grid x:Name="PART_ContentRoot">
        <Border Padding="{TemplateBinding Control.Padding}" SnapsToDevicePixels="True">
          <if:FieldContentPresenter
            x:Name="PART_ContentHost"
            SnapsToDevicePixels="True"
            HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
            VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"/>
        </Border>
      </Grid>
    </Border>
  </ControlTemplate>
   
  <ControlTemplate x:Key="DisplayFieldTemplate" TargetType="{x:Type ifp:DisplayField}">
    <Border Background="{TemplateBinding Panel.Background}"
        BorderBrush="{TemplateBinding Control.BorderBrush}"
        BorderThickness="{TemplateBinding Control.BorderThickness}"
        Padding="{TemplateBinding Control.Padding}"
        Name="Bd"
        SnapsToDevicePixels="True">
      <if:FieldContentPresenter
        x:Name="PART_ContentHost"
        SnapsToDevicePixels="True"
        HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
        VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"/>
    </Border>
  </ControlTemplate>

  <Style x:Key="EditBaseStyle" TargetType="{x:Type imp:EditBase}">
    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
    <Setter Property="Border.BorderThickness" Value="1" />
    <Setter Property="Border.BorderBrush" Value="{StaticResource EditorBorder}"/>
    <Setter Property="Control.Padding" Value="1" />
    <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}" />
  </Style>

  <Style x:Key="FieldsEditorControlStyle" TargetType="{x:Type imp:FieldsEditorControl}" BasedOn="{StaticResource EditBaseStyle}">
    <Setter Property="Template" Value="{StaticResource FieldsEditorControlTemplate}"/>
  </Style>

  <Style x:Key="FieldStyle" TargetType="{x:Type ifp:Field}">
    <Setter Property="Control.Margin" Value="0" />
    <Setter Property="Control.Padding" Value="0" />
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="Template" Value="{StaticResource FieldTemplate}" />
  </Style>

  <Style x:Key="DropdownFieldSytle" TargetType="{x:Type ifp:Field}" BasedOn="{StaticResource FieldStyle}">
    <Setter Property="Template" Value="{StaticResource DropDownFieldTemplate}"/>
  </Style>

  <Style x:Key="DisplayFieldStyle" TargetType="{x:Type ifp:DisplayField}">
    <Setter Property="Control.Margin" Value="0" />
    <Setter Property="Control.Padding" Value="0" />
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="Template" Value="{StaticResource DisplayFieldTemplate}" />
  </Style>
</ResourceDictionary>
関連トピック

 

 


© MESCIUS inc. All rights reserved.