私はwpf-mvvmアプリケーションを持っています。
以下のコードでは、「PartBPremiumBuydown」はクラスのインスタンスです。これには2つのプロパティがあります=>1。値。および2.HasValidationError。
プロパティ「値」は、テキストボックスへのバインドに使用されます。検証エラーがある場合...HasValidationError= trueを設定できますか?
<TextBox ToolTip="{Binding RelativeSource={RelativeSource Self},
Path=(Validation.Errors).CurrentItem.ErrorContent}">
<TextBox.Text>
<Binding Path="PartBPremiumBuydown.Value"
ValidatesOnDataErrors="True"
UpdateSourceTrigger="PropertyChanged"
Converter="{x:Static localns:Converters.DecimalToCurrency}">
<Binding.ValidationRules>
<localns:CurrencyRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>