BindingGroup.NotifyOnValidationError Propiedad

Definición

Obtiene o establece si el evento Error se provoca cuando cambia el estado de 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

Valor de propiedad

Es true si el evento Error se provoca cuando cambia el estado de ValidationRule; de lo contrario, es false. De manera predeterminada, es false.

Ejemplos

En el ejemplo siguiente se crea un BindingGroup objeto y se establece NotifyOnValidationError en true para que la aplicación pueda controlar el Validation.Error evento cuando se produce un ValidationRule error.

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

En el ejemplo siguiente, se controla el evento 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

Comentarios

El Validation.Error evento adjunto se produce en el elemento que tiene .BindingGroup

Se aplica a