MESCIUS InputMan for WPF 3.0J
SideButton.xaml

SideButton.xaml では、フィールドのサイドボタンの外観を定義します。

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

SideButton.xaml の内容
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:imp="clr-namespace:GrapeCity.Windows.InputMan.Primitives;assembly=GrapeCity.WPF.InputMan">
  
  <Geometry x:Key="DownArrowGeometry">M 0 0 L 3.5 4 L 7 0 Z</Geometry>
  <Geometry x:Key="UpArrowGeometry">M 0 4 L 3.5 0 L 7 4 Z</Geometry>

  <Style TargetType="{x:Type imp:SpinButton}" BasedOn="{StaticResource {x:Type RepeatButton}}">
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="ClickMode" Value="Press"/>
    <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>    
    <Setter Property="ContentTemplate">
      <Setter.Value>
        <DataTemplate DataType="{x:Type Geometry}">
          <Path Fill="{TemplateBinding TextElement.Foreground}" Data="{Binding}" 
              HorizontalAlignment="Center"
              VerticalAlignment="Center"/>
        </DataTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="{x:Type imp:DropDownButton}" BasedOn="{StaticResource {x:Type ToggleButton}}" x:Key="DropDownButton_StyleKey">
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="ClickMode" Value="Press"/>
    <Setter Property="Content" Value="{StaticResource DownArrowGeometry}"/>
    <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>    
    <Setter Property="ContentTemplate">
      <Setter.Value>
        <DataTemplate DataType="{x:Type Geometry}">
          <Path Fill="{TemplateBinding TextElement.Foreground}" Data="{Binding}" 
              HorizontalAlignment="Center"
              VerticalAlignment="Center"/>
        </DataTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="imp:DropDownButton" BasedOn="{StaticResource DropDownButton_StyleKey}"/>
</ResourceDictionary>
関連トピック

 

 


© MESCIUS inc. All rights reserved.