BindingGroup.NotifyOnValidationError Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta un valore che indica se l'evento Error si verifica quando lo stato di un oggetto ValidationRule cambia.
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
Valore della proprietà
true se l'evento Error si verifica quando lo stato di un ValidationRule oggetto viene modificato; in caso contrario, false. Il valore predefinito è false.
Esempio
Nell'esempio seguente viene creato un BindingGroup e viene impostato su NotifyOnValidationErrortrue in modo che l'applicazione possa gestire l'evento Validation.Error in caso di ValidationRule errore.
<StackPanel.BindingGroup>
<BindingGroup NotifyOnValidationError="True">
<BindingGroup.ValidationRules>
<src:ValidateDateAndPrice ValidationStep="ConvertedProposedValue" />
</BindingGroup.ValidationRules>
</BindingGroup>
</StackPanel.BindingGroup>
L'esempio seguente gestisce l'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
Commenti
L'evento Validation.Error associato si verifica sull'elemento con .BindingGroup