本文整理匯總了C#中System.Windows.Controls.ValidationErrorEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# ValidationErrorEventArgs類的具體用法?C# ValidationErrorEventArgs怎麽用?C# ValidationErrorEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ValidationErrorEventArgs類屬於System.Windows.Controls命名空間,在下文中一共展示了ValidationErrorEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PhoneApplicationPage_BindingValidationError
private void PhoneApplicationPage_BindingValidationError(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
{
MessageBox.Show(e.Error.Exception.Message, "Error", MessageBoxButton.OK);
}
}
示例2: OnValidationError
/// <summary>
/// プレゼン用 テキストボックスのバリデーションエラーを捕まえることができる
/// </summary>
/// <param name="sender">送信オブジェクト</param>
/// <param name="e">バリデーションエラーに関するパラメータ</param>
private void OnValidationError(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
{
// バリデーションエラーが発生したときの処理を追加できます
}
}
示例3: ValidationError
private void ValidationError(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
{
MessageBox.Show(e.Error.ErrorContent.ToString());
}
}
示例4: UIStaff_BindingValidationError
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void UIStaff_BindingValidationError(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
hasError = true;
else if (e.Action == ValidationErrorEventAction.Removed)
hasError = false;
}
示例5: EntityValidationError
public void EntityValidationError(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
EntityErrorCount++;
else if (EntityErrorCount > 0)
EntityErrorCount--;
}
示例6: Validation_Error
private void Validation_Error(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
_errors++;
else
_errors--;
}
示例7: grdConfig_ValidationError
private void grdConfig_ValidationError(object sender, ValidationErrorEventArgs e) {
if (e.Action == ValidationErrorEventAction.Added)
_validationErrors.Add(e.Error);
else
_validationErrors.Remove(e.Error);
btSave.IsEnabled = _validationErrors.Count == 0;
}
示例8: Validation_Error
private void Validation_Error(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
_noOfErrorsOnScreen++;
else
_noOfErrorsOnScreen--;
}
示例9: CheckEntityListError
public static void CheckEntityListError(ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
EntityListErrorCount++;
else if (EntityListErrorCount > 0)
EntityListErrorCount--;
}
示例10: validationError
/// <summary>
/// 使用數據驗證後,對數據進行驗證
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private static void validationError(object sender, ValidationErrorEventArgs args)
{
if ((sender as FrameworkElement).DataContext != null && (sender as FrameworkElement).DataContext as IDataValidationInfo != null)
{
IDataValidationInfo dataValition = (sender as FrameworkElement).DataContext as IDataValidationInfo;
bool isSuccess = (bool)((args.OriginalSource as FrameworkElement).GetValue(Validation.HasErrorProperty));
Binding bind = ((System.Windows.Data.BindingExpression)((System.Windows.Controls.ValidationError)args.Error).BindingInError).ParentBinding;
if (bind != null)
{
string propetyName;
if (bind.Source != null)
{
propetyName = bind.Path.Path + "@" + bind.Source.GetHashCode();
}
else
{
propetyName = bind.Path.Path + "@" + (sender as FrameworkElement).DataContext.GetHashCode();
}
if (isSuccess && args.Action == ValidationErrorEventAction.Added)
{
dataValition.Added(propetyName, args.Error.ErrorContent);
}
else if (!isSuccess && args.Action == ValidationErrorEventAction.Removed)
{
dataValition.Removed(propetyName);
}
}
}
}
示例11: ControlsPanel_BindingValidationError
/// <summary>
/// Shows the errors in a message box if any
/// </summary>
private void ControlsPanel_BindingValidationError(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
{
hasErrors = true;
MessageBox.Show(e.Error.ErrorContent.ToString());
}
}
示例12: Validation_Error
private void Validation_Error(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
errorCount++;
if (e.Action == ValidationErrorEventAction.Removed)
errorCount--;
if (this.ok != null)
this.ok.IsEnabled = (errorCount == 0);
}
示例13: SurNameTextBox_Error
private void SurNameTextBox_Error(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
{
System.Console.Beep();
MessageBox.Show(e.Error.ErrorContent.ToString());
}
else
System.Diagnostics.Trace.WriteLine("Validation error cleared");
}
示例14: txt_Error
private void txt_Error(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
{
((Control)sender).ToolTip = e.Error.ErrorContent.ToString();
}
else
{
((Control)sender).ToolTip = "";
}
}
示例15: Element_ValidationError
private void Element_ValidationError(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added && !_errorMessages.Contains(e.Error.ErrorContent.ToString()))
{
_errorMessages.Add(e.Error.ErrorContent.ToString());
}
else if (e.Action == ValidationErrorEventAction.Removed && _errorMessages.Contains(e.Error.ErrorContent.ToString()))
{
_errorMessages.Remove(e.Error.ErrorContent.ToString());
}
}