0
我试图改变文本框的样式。到现在为止,我已经做我的文本框显示了它的边界与此代码正确的asterisc:在WPF中使用IDataErrorInfo设置文本框的样式
<Style TargetType="{x:Type TextBox}">
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
<ControlTemplate>
<Grid>
<TextBlock DockPanel.Dock="Right" HorizontalAlignment="Right" Foreground="Red" FontSize="14pt" FontWeight="Bold" Text="*"></TextBlock>
<Border BorderBrush="Red" BorderThickness="1">
<AdornedElementPlaceholder Name="controlWithError"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
,但我想我的文本框上右上角红色三角形显示。我怎么能在我的文本框中获得这种风格?
谢谢。