BindingGroup.NotifyOnValidationError Eigenschaft

Definition

Ruft ab oder legt fest, ob das Error Ereignis auftritt, wenn sich der Status einer ValidationRule Änderung ändert.

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

Eigenschaftswert

true wenn das Error Ereignis auftritt, wenn sich der Zustand einer ValidationRule Änderung ändert; andernfalls false. Der Standardwert lautet false.

Beispiele

Im folgenden Beispiel wird ein BindingGroup Ereignis erstellt und festgelegt NotifyOnValidationErrortrue , sodass die Anwendung das Validation.Error Ereignis behandeln kann, wenn ein ValidationRule Fehler auftritt.

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

Im folgenden Beispiel wird das Validation.Error-Ereignis verarbeitet.

// 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

Hinweise

Das Validation.Error angefügte Ereignis tritt auf dem Element auf, das über das BindingGroupElement verfügt.

Gilt für: