Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Style TargetType="local:NumericTextBox">
- <Style.Resources>
- <ControlTemplate x:Key="ValidationErrorTemplate1">
- <StackPanel>
- <Border BorderBrush="Red"
- BorderThickness="1"
- HorizontalAlignment="Left">
- <!-- Placeholder for the NumericTextBox itself -->
- <AdornedElementPlaceholder x:Name="AdornedElement" />
- </Border>
- <Border Background="White"
- BorderBrush="Red"
- Padding="4"
- BorderThickness="1"
- HorizontalAlignment="Left">
- <ItemsControl ItemsSource="{Binding}"
- HorizontalAlignment="Left">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding ErrorContent}"
- Foreground="Red" />
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </Border>
- </StackPanel>
- </ControlTemplate>
- </Style.Resources>
- <Setter Property="Background"
- Value="{x:Static SystemColors.ControlLightBrush}" />
- <Setter Property="BorderBrush"
- Value="{x:Static SystemColors.ActiveBorderBrush}" />
- <Setter Property="BorderThickness"
- Value="1" />
- <Setter Property="Validation.ErrorTemplate"
- Value="{StaticResource ValidationErrorTemplate1}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="local:NumericTextBox">
- <Border Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Padding="{TemplateBinding Padding}">
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualState x:Name="Normal" />
- <VisualState x:Name="Disabled">
- <Storyboard>
- <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
- Storyboard.TargetProperty="(Panel.Background).
- (SolidColorBrush.Color)">
- <EasingColorKeyFrame KeyTime="0"
- Value="{x:Static SystemColors.InactiveBorderColor}" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- <VisualState x:Name="ReadOnly" />
- <VisualState x:Name="MouseOver" />
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <ScrollViewer Margin="0"
- x:Name="PART_ContentHost" />
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement