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
- Int16Converter.cs
- XmlSchemaGroupRef.cs
- ByeMessageCD1.cs
- TogglePattern.cs
- PagesSection.cs
- WebPartEditorApplyVerb.cs
- XamlParser.cs
- PackWebResponse.cs
- StringValueSerializer.cs
- ExecutionContext.cs
- DeviceFilterDictionary.cs
- OracleString.cs
- MediaCommands.cs
- SoapMessage.cs
- SqlDataSource.cs
- XmlSortKeyAccumulator.cs
- IIS7UserPrincipal.cs
- GeneralTransform2DTo3DTo2D.cs
- XPathChildIterator.cs
- TypeUtil.cs
- Evidence.cs
- Triangle.cs
- BulletChrome.cs
- SmiMetaDataProperty.cs
- SecurityPolicySection.cs
- PointHitTestParameters.cs
- BuildProviderInstallComponent.cs
- ListViewItemEventArgs.cs
- DataGridTextBoxColumn.cs
- Globals.cs
- TripleDES.cs
- TransportReplyChannelAcceptor.cs
- StorageAssociationTypeMapping.cs
- EventLog.cs
- TypeInitializationException.cs
- WebInvokeAttribute.cs
- Expander.cs
- TreeViewAutomationPeer.cs
- ExcludeFromCodeCoverageAttribute.cs
- OleDbException.cs
- SerializationFieldInfo.cs
- ArgumentException.cs
- WeakEventTable.cs
- TouchFrameEventArgs.cs
- ListControl.cs
- WebPartCatalogAddVerb.cs
- UnlockInstanceCommand.cs
- x509store.cs
- Typography.cs
- QueryAccessibilityHelpEvent.cs
- PropertyMapper.cs
- DataGridViewCellMouseEventArgs.cs
- DataTable.cs
- DeleteMemberBinder.cs
- TextBoxDesigner.cs
- DefaultShape.cs
- XamlTreeBuilder.cs
- XmlEncoding.cs
- WMIGenerator.cs
- BinaryWriter.cs
- SoapTypeAttribute.cs
- AggregateException.cs
- PersonalizableAttribute.cs
- ParameterReplacerVisitor.cs
- EntityParameterCollection.cs
- Identifier.cs
- CounterSetInstance.cs
- EntityDataReader.cs
- SendMailErrorEventArgs.cs
- FormViewCommandEventArgs.cs
- TreeViewCancelEvent.cs
- UpdatePanelTriggerCollection.cs
- ExpressionBinding.cs
- MouseOverProperty.cs
- SimpleExpression.cs
- XmlObjectSerializerWriteContextComplex.cs
- EpmSyndicationContentSerializer.cs
- RunWorkerCompletedEventArgs.cs
- StringKeyFrameCollection.cs
- RawStylusActions.cs
- ImageConverter.cs
- SdlChannelSink.cs
- TypefaceMetricsCache.cs
- ChtmlFormAdapter.cs
- XXXOnTypeBuilderInstantiation.cs
- SizeConverter.cs
- EventItfInfo.cs
- DataGridColumn.cs
- CheckBoxPopupAdapter.cs
- MsmqHostedTransportManager.cs
- ConfigurationProperty.cs
- HttpCacheVary.cs
- NotImplementedException.cs
- StrongNameMembershipCondition.cs
- CacheVirtualItemsEvent.cs
- PlainXmlDeserializer.cs
- LocatorManager.cs
- FixUp.cs
- SolidColorBrush.cs
- TiffBitmapDecoder.cs