public ValidationSummaryItem(string message, string header, ValidationSummaryItemType itemType, ValidationSummarySource source) { Header = header; Message = message; ItemType = itemType; Source = source; }
/// <summary> /// Initializes a new instance of the ValidationSummaryItem class. /// </summary> /// <param name="message">The error message.</param> /// <param name="messageHeader">The header/prefix of the item, such as the property name.</param> /// <param name="itemType">The type of error, such as Property or Entity level.</param> /// <param name="source">The source of the error message, including the originating control and/or property name.</param> /// <param name="context">Context from which the error occurred. This general property can be used as a container to keep track of the entity, for instance.</param> public ValidationSummaryItem(string message, string messageHeader, ValidationSummaryItemType itemType, ValidationSummaryItemSource source, object context) { this.MessageHeader = messageHeader; this.Message = message; this.ItemType = itemType; this.Context = context; this.Sources = new ObservableCollection <ValidationSummaryItemSource>(); if (source != null) { this.Sources.Add(source); } }
/// <summary> /// Initializes a new instance of the ValidationSummaryItem class. /// </summary> /// <param name="message">The error message.</param> /// <param name="messageHeader">The header/prefix of the item, such as the property name.</param> /// <param name="itemType">The type of error, such as Property or Entity level.</param> /// <param name="source">The source of the error message, including the originating control and/or property name.</param> /// <param name="context">Context from which the error occurred. This general property can be used as a container to keep track of the entity, for instance.</param> public ValidationSummaryItem(string message, string messageHeader, ValidationSummaryItemType itemType, ValidationSummaryItemSource source, object context) { this.MessageHeader = messageHeader; this.Message = message; this.ItemType = itemType; this.Context = context; this.Sources = new ObservableCollection<ValidationSummaryItemSource>(); if (source != null) { this.Sources.Add(source); } }
internal void ClearErrors(ValidationSummaryItemType errorType) { var validationItemCollection = new List <ValidationSummaryItem>(); foreach (var validationSummaryItem in this) { if (validationSummaryItem != null && validationSummaryItem.ItemType == errorType) { validationItemCollection.Add(validationSummaryItem); } } foreach (var validationSummaryItem in validationItemCollection) { Remove(validationSummaryItem); } }
/// <summary> /// Clears errors of the given source type /// </summary> /// <param name="errorType">The type of the error (Entity or Property)</param> internal void ClearErrors(ValidationSummaryItemType errorType) { // Clear entity errors ValidationItemCollection errorsToRemove = new ValidationItemCollection(); foreach (ValidationSummaryItem error in this) { if (error != null && error.ItemType == errorType) { errorsToRemove.Add(error); } } foreach (ValidationSummaryItem error in errorsToRemove) { this.Remove(error); } }
internal void ClearErrors(ValidationSummaryItemType errorType) { ValidationItemCollection items = new ValidationItemCollection(); foreach (ValidationSummaryItem item in this) { if (item == null) { continue; } if (item.ItemType == errorType) { items.Add(item); } } foreach (ValidationSummaryItem item2 in items) { base.Remove(item2); } }
// // Summary: // Initializes a new instance of the System.Windows.Controls.ValidationSummaryItem // class with the specified error message, header, item type, source, and context. // // Parameters: // message: // The text of the error message. // // messageHeader: // The header of the item, such as the property name. // // itemType: // Specifies whether the error originated from an object or a property. // // source: // The source of the error message, including the originating control or property // name. // // context: // The context in which the error occurred. public ValidationSummaryItem(string message, string messageHeader, ValidationSummaryItemType itemType, ValidationSummaryItemSource source, object context) { }