BindingGroup.NotifyOnValidationError Tulajdonság

Definíció

Lekérdezi vagy beállítja, hogy az Error esemény akkor következik-e be, amikor egy ValidationRule adott állapot megváltozik.

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

Tulajdonság értéke

trueha az Error esemény akkor következik be, ha egy ValidationRule állapot megváltozik; ellenkező esetben. false Az alapértelmezett érték a false.

Példák

Az alábbi példa létrehoz egy BindingGroup és beállítja NotifyOnValidationError azt true , hogy az alkalmazás kezelni tudja az Validation.Error eseményt, ha egy ValidationRule sikertelen esemény meghiúsul.

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

Az alábbi példa a Validation.Error eseményt kezeli.

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

Megjegyzések

A Validation.Error csatolt esemény azon az elemen történik, amelynek a BindingGroup.

A következőre érvényes: