BindingGroup.NotifyOnValidationError プロパティ

定義

Error の状態が変化したときに ValidationRule イベントが発生するかどうかを取得または設定します。

public:
 property bool NotifyOnValidationError { bool get(); void set(bool value); };
public bool NotifyOnValidationError { get; set; }
member this.NotifyOnValidationError : bool with get, set
Public Property NotifyOnValidationError As Boolean

プロパティ値

Error の状態が変化すると ValidationRule イベントが発生する場合は true。それ以外の場合は false。 既定値は、false です。

次の例では、 をBindingGroup作成し、 を にtrue設定NotifyOnValidationErrorして、 が失敗したときにアプリケーションがValidationRuleイベントをValidation.Error処理できるようにします。

<StackPanel.BindingGroup>
  <BindingGroup NotifyOnValidationError="True">
    <BindingGroup.ValidationRules>
      <src:ValidateDateAndPrice ValidationStep="ConvertedProposedValue" />
    </BindingGroup.ValidationRules>
  </BindingGroup>
</StackPanel.BindingGroup>

次の例では、Validation.Error イベントを処理します。

// This event occurs when a ValidationRule in the BindingGroup
// or in a Binding fails.
private void ItemError(object sender, ValidationErrorEventArgs e)
{
    if (e.Action == ValidationErrorEventAction.Added)
    {
        MessageBox.Show(e.Error.ErrorContent.ToString());
    }
}
' This event occurs when a ValidationRule in the BindingGroup
' or in a Binding fails.
Private Sub ItemError(ByVal sender As Object, ByVal e As ValidationErrorEventArgs)
    If e.Action = ValidationErrorEventAction.Added Then
        MessageBox.Show(e.Error.ErrorContent.ToString())

    End If
End Sub

注釈

添付イベントは Validation.Error 、 を持つ 要素で発生します BindingGroup

適用対象