Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / MS / Internal / Data / BindingCollection.cs / 1 / BindingCollection.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Defines BindingList object, a list of binds. // // Specs: [....]/connecteddata/M5%20Specs/UIBind.mht // //--------------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Windows; using System.Windows.Markup; using System.Windows.Data; using MS.Utility; using MS.Internal; namespace MS.Internal.Data { ////// A list of bindingss, used by MultiBinding classes. /// internal class BindingCollection : Collection{ //----------------------------------------------------- // // Constructors // //----------------------------------------------------- /// Constructor internal BindingCollection(BindingBase owner, BindingCollectionChangedCallback callback) { Invariant.Assert(owner != null && callback != null); _owner = owner; _collectionChangedCallback = callback; } // disable default constructor private BindingCollection() { } //------------------------------------------------------ // // Protected Methods // //----------------------------------------------------- #region Protected Methods ////// called by base class Collection<T> when the list is being cleared; /// raises a CollectionChanged event to any listeners /// protected override void ClearItems() { _owner.CheckSealed(); base.ClearItems(); OnBindingCollectionChanged(); } ////// called by base class Collection<T> when an item is removed from list; /// raises a CollectionChanged event to any listeners /// protected override void RemoveItem(int index) { _owner.CheckSealed(); base.RemoveItem(index); OnBindingCollectionChanged(); } ////// called by base class Collection<T> when an item is added to list; /// raises a CollectionChanged event to any listeners /// protected override void InsertItem(int index, BindingBase item) { if (item == null) throw new ArgumentNullException("item"); ValidateItem(item); _owner.CheckSealed(); base.InsertItem(index, item); OnBindingCollectionChanged(); } ////// called by base class Collection<T> when an item is added to list; /// raises a CollectionChanged event to any listeners /// protected override void SetItem(int index, BindingBase item) { if (item == null) throw new ArgumentNullException("item"); ValidateItem(item); _owner.CheckSealed(); base.SetItem(index, item); OnBindingCollectionChanged(); } #endregion Protected Methods //------------------------------------------------------ // // Private Methods // //------------------------------------------------------ void ValidateItem(BindingBase binding) { // for V1, we only allow Binding as an item of BindingCollection. if (!(binding is Binding)) throw new NotSupportedException(SR.Get(SRID.BindingCollectionContainsNonBinding, binding.GetType().Name)); } void OnBindingCollectionChanged() { if (_collectionChangedCallback != null) _collectionChangedCallback(); } //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ BindingBase _owner; private BindingCollectionChangedCallback _collectionChangedCallback; } // the delegate to use for getting BindingListChanged notifications internal delegate void BindingCollectionChangedCallback(); } // 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
- QuotedPrintableStream.cs
- StylusCaptureWithinProperty.cs
- RegexReplacement.cs
- HtmlTableRow.cs
- PointHitTestParameters.cs
- HebrewCalendar.cs
- TypeDependencyAttribute.cs
- XmlStringTable.cs
- DataError.cs
- XmlSerializerFactory.cs
- LookupNode.cs
- ValueTable.cs
- TextDecorationCollection.cs
- DispatcherHookEventArgs.cs
- RuntimeConfig.cs
- MouseActionValueSerializer.cs
- PersonalizationStateQuery.cs
- PrintDialog.cs
- SafeBitVector32.cs
- ConsoleTraceListener.cs
- RIPEMD160Managed.cs
- Timer.cs
- SelectionRange.cs
- CDSCollectionETWBCLProvider.cs
- SamlAuthenticationClaimResource.cs
- Model3DCollection.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- ResetableIterator.cs
- TextParagraph.cs
- SystemIPGlobalStatistics.cs
- SoapFormatterSinks.cs
- Behavior.cs
- Normalization.cs
- SoapProtocolReflector.cs
- CurrentTimeZone.cs
- TextTrailingCharacterEllipsis.cs
- XmlDocumentFieldSchema.cs
- ButtonChrome.cs
- StructureChangedEventArgs.cs
- MembershipAdapter.cs
- TableTextElementCollectionInternal.cs
- HwndTarget.cs
- DataGridItem.cs
- EntryWrittenEventArgs.cs
- FamilyMap.cs
- AudioException.cs
- MeshGeometry3D.cs
- PeerPresenceInfo.cs
- Compiler.cs
- PathGradientBrush.cs
- MimeReturn.cs
- AuthenticationService.cs
- Vector3DCollectionValueSerializer.cs
- ADMembershipProvider.cs
- NumberAction.cs
- Math.cs
- GeneralTransform3D.cs
- SerializationException.cs
- WebResponse.cs
- ProfilePropertySettings.cs
- SID.cs
- Label.cs
- TextEncodedRawTextWriter.cs
- PtsCache.cs
- Exception.cs
- AmbientLight.cs
- ToolStripItemBehavior.cs
- References.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- SettingsPropertyValue.cs
- FlowDocumentFormatter.cs
- PlainXmlSerializer.cs
- HttpProfileGroupBase.cs
- CompositeCollection.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- RegexCompiler.cs
- SQLBytesStorage.cs
- BindingParameterCollection.cs
- WebBaseEventKeyComparer.cs
- TableAdapterManagerMethodGenerator.cs
- BitFlagsGenerator.cs
- EntityDataSourceChangedEventArgs.cs
- ConfigurationLocation.cs
- HtmlWindow.cs
- ResolvedKeyFrameEntry.cs
- HttpApplication.cs
- StorageMappingFragment.cs
- SharedDp.cs
- SoapAttributeAttribute.cs
- PtsContext.cs
- MD5CryptoServiceProvider.cs
- StreamGeometry.cs
- DataColumnChangeEvent.cs
- RepeaterItemEventArgs.cs
- DateTimeOffsetStorage.cs
- BufferedStream.cs
- XpsS0ValidatingLoader.cs
- OdbcDataReader.cs
- TemplateNameScope.cs
- PasswordBoxAutomationPeer.cs