我创建了一个小的WPF应用程序,页面上有许多文本框。所有这些文本框都有圆角。
我使用了MVVM模式并实现了IDataErrorInfo接口来向用户显示错误。当其中一个文本框的边缘为空时,工具提示应该显示为红色,这是我成功完成的。
我现在希望红色边缘也有圆角,如文本框。如图所示,红色边框显示为文本框为空,红色边框需要有一个角半径。
<!-- Text box xaml code that is used to display the error and binding -->
<TextBox Style="{StaticResource TextBoxBase}"
Name="FirstName"
Text="{Binding FirstName, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, Source={StaticResource CustomerObject}, ValidatesOnDataErrors=True}"/>
<!-- Code that changes the tool tip if it's null -->
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}" />
</Trigger>
</Style.Triggers>