Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / MS / Internal / Controls / ValidationErrorCollection.cs / 1 / ValidationErrorCollection.cs
//---------------------------------------------------------------------------- // //// Copyright (C) 2003 by Microsoft Corporation. All rights reserved. // // // // Description: // ValidationErrorCollection contains the list of ValidationErrors from // the various Bindings and MultiBindings on an Element. ValidationErrorCollection // be set through the Validation.ErrorsProperty. // // See specs at [....]/connecteddata/Specs/Validation.mht // // History: // 5/3/2004 [....]: created. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows; using System.Windows.Controls; using System.Windows.Data; namespace MS.Internal.Controls { ////// ValidationErrorCollection contains the list of ValidationErrors from /// the various Bindings and MultiBindings on an Element. ValidationErrorCollection /// be set through the Validation.ErrorsProperty. /// internal class ValidationErrorCollection : ObservableCollection{ /// /// Empty collection that serves as a default value for /// Validation.ErrorsProperty. /// public static readonly ReadOnlyObservableCollectionEmpty = new ReadOnlyObservableCollection (new ValidationErrorCollection()); /// /// called by base class Collection<T> when an item is added to list; /// protected override void InsertItem(int index, ValidationError item) { int existingIndex = FindErrorForBinding(item.BindingInError); // if there is already a ValidationError for this binding, // then throw if (existingIndex > -1) { throw new ArgumentException(SR.Get(SRID.DuplicatesNotAllowed), "validationError"); } base.InsertItem(index, item); } //----------------------------------------------------- // // Internal Methods // //----------------------------------------------------- #region Internal Methods static internal ReadOnlyObservableCollectionGetReadOnlyErrors(DependencyObject d) { ValidationErrorCollection errors = Validation.GetErrorsInternal(d); if (errors != null) { if (errors._readonlyWrapper == null) { errors._readonlyWrapper = new ReadOnlyObservableCollection (errors); } return errors._readonlyWrapper; } else { return Empty; } } #endregion Internal Methods //------------------------------------------------------ // // Private Methods // //----------------------------------------------------- #region Private Methods private int FindErrorForBinding(object binding) { for (int i = 0; i < this.Count; i++) { if (this[i].BindingInError == binding) { return i; } } return -1; } #endregion Private Methods ReadOnlyObservableCollection _readonlyWrapper; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IssuanceLicense.cs
- AtomServiceDocumentSerializer.cs
- DataRecord.cs
- ValidationResults.cs
- TextEditorParagraphs.cs
- WebPartExportVerb.cs
- PersonalizationStateInfoCollection.cs
- ConstrainedGroup.cs
- ServiceThrottlingElement.cs
- SqlEnums.cs
- ByteFacetDescriptionElement.cs
- WebConfigurationHostFileChange.cs
- RefreshEventArgs.cs
- WindowsPen.cs
- DashStyle.cs
- AsymmetricSecurityBindingElement.cs
- MasterPageCodeDomTreeGenerator.cs
- AssociationTypeEmitter.cs
- Propagator.Evaluator.cs
- ApplicationInterop.cs
- StrokeNodeOperations.cs
- ConnectionString.cs
- SwitchAttribute.cs
- TableColumnCollectionInternal.cs
- Compensate.cs
- TaskFormBase.cs
- streamingZipPartStream.cs
- WorkflowMarkupSerializationProvider.cs
- ComplexPropertyEntry.cs
- AssemblyName.cs
- OleDbReferenceCollection.cs
- GC.cs
- GenerateScriptTypeAttribute.cs
- TcpProcessProtocolHandler.cs
- OleDbConnectionInternal.cs
- Events.cs
- VirtualDirectoryMapping.cs
- ScrollEvent.cs
- FixUp.cs
- TraceUtility.cs
- HitTestParameters3D.cs
- CatalogZoneBase.cs
- Geometry3D.cs
- SecurityContextSecurityTokenParameters.cs
- GridViewHeaderRowPresenter.cs
- DescendantBaseQuery.cs
- XslVisitor.cs
- Emitter.cs
- CompositeClientFormatter.cs
- SQLByte.cs
- NotSupportedException.cs
- TextAdaptor.cs
- ToolStripSettings.cs
- ListBase.cs
- CannotUnloadAppDomainException.cs
- ItemPager.cs
- XXXInfos.cs
- Metadata.cs
- XmlSerializerVersionAttribute.cs
- ActivityTypeDesigner.xaml.cs
- smtppermission.cs
- XhtmlStyleClass.cs
- Int32CAMarshaler.cs
- ContentType.cs
- XamlTypeMapper.cs
- SqlClientWrapperSmiStream.cs
- DocumentViewerBaseAutomationPeer.cs
- BitmapVisualManager.cs
- RepeatEnumerable.cs
- XmlSerializerSection.cs
- QueryMath.cs
- XmlIgnoreAttribute.cs
- XmlSchemaSimpleContent.cs
- Literal.cs
- WSFederationHttpSecurityElement.cs
- WebConfigurationHost.cs
- ListItemCollection.cs
- CAGDesigner.cs
- RenderData.cs
- PrintDialogDesigner.cs
- ChannelManager.cs
- Size.cs
- BinaryFormatterWriter.cs
- AndAlso.cs
- AutoCompleteStringCollection.cs
- EditorResources.cs
- HtmlWindow.cs
- KerberosReceiverSecurityToken.cs
- WebPartCloseVerb.cs
- ToolStripOverflowButton.cs
- TextProperties.cs
- RenderCapability.cs
- VirtualDirectoryMappingCollection.cs
- PermissionSet.cs
- ValidatorCompatibilityHelper.cs
- FormClosingEvent.cs
- WebBrowserNavigatedEventHandler.cs
- PropertyTabAttribute.cs
- FontWeights.cs
- SafeNativeMethodsMilCoreApi.cs