MESCIUS InputMan for WPF 3.0J > InputMan for WPF の使い方 > テーマテンプレートを使用する > テーマテンプレートのカスタマイズ > ValidationIndicator.xaml |
ValidationIndicator.xaml では、検証インジケータコントロールの外観を定義します。
ValidationIndicator.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"> <Style TargetType="{x:Type im:GcValidationIndicator}"> <Setter Property="Control.Padding" Value="1" /> <Setter Property="IsTabStop" Value="False" /> <Setter Property="Focusable" Value="False" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="im:GcValidationIndicator"> <Grid x:Name="PART_ERRORICON" x:Shared="false" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="Hidden"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="ValidateStates"> <VisualState x:Name="Empty"> <Storyboard> <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_ERRORICON" Storyboard.TargetProperty="Visibility"> <ObjectAnimationUsingKeyFrames.KeyFrames> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Hidden</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="HasErrors"> <Storyboard> <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_ERRORICON" Storyboard.TargetProperty="Visibility"> <ObjectAnimationUsingKeyFrames.KeyFrames> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid.RowDefinitions> <RowDefinition Height="2*"/> <RowDefinition Height="6*"/> <RowDefinition Height="2*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="4*"/> <ColumnDefinition Width="2*"/> <ColumnDefinition Width="4*"/> </Grid.ColumnDefinitions> <Ellipse Grid.ColumnSpan="3" Grid.RowSpan="3"> <Ellipse.Fill> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Offset="1" Color="#FFFF0000"/> <GradientStop Offset="0" Color="#FFFDFDFD"/> </LinearGradientBrush> </Ellipse.Fill> <Ellipse.Stroke> <LinearGradientBrush StartPoint="0.505,0.65" EndPoint="0.298,0.3"> <GradientStop Color="#FFD3D3D3"/> <GradientStop Offset="1" Color="#D3D3D3D3"/> </LinearGradientBrush> </Ellipse.Stroke> </Ellipse> <Path Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M0.5,0.600 C0.5,0.544 0.544,0.5 0.600,0.5 L2.400,0.5 C2.455,0.5 2.5,0.544 2.5,0.600 L2.5,1.621 C2.5,1.676 2.455,1.721 2.400,1.721 L0.600,1.721 C0.544,1.721 0.5,1.676 0.5,1.621 z M0.500,3.315 C0.500,3.259 0.544,3.215 0.600,3.215 L2.400,3.215 C2.455,3.215 2.500,3.259 2.500,3.315 L2.500,8.400 C2.500,8.455 2.455,8.500 2.400,8.500 L0.600,8.500 C0.544,8.500 0.500,8.455 0.500,8.400 z" Stretch="Fill" Stroke="#D3FFFFFF"> <Path.Fill> <LinearGradientBrush StartPoint="0.413,0.653" EndPoint="0.39,0.297"> <GradientStop Color="#FFFFFFFF"/> <GradientStop Offset="0.781" Color="#D3FFFFFF"/> <GradientStop Offset="0.982" Color="#FFFFFFFF"/> </LinearGradientBrush> </Path.Fill> <Path.RenderTransform> <RotateTransform Angle="180"/> </Path.RenderTransform> <Path.RenderTransformOrigin> <Point X="0.5" Y="0.5"/> </Path.RenderTransformOrigin> </Path> <ToolTipService.ToolTip> <ListBox ItemsSource="{TemplateBinding ErrorContents}" BorderThickness="0" Background="Transparent"/> </ToolTipService.ToolTip> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary>