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
- Validator.cs
- UIElement3D.cs
- ContentDisposition.cs
- CheckBoxRenderer.cs
- Msec.cs
- StringTraceRecord.cs
- Pkcs9Attribute.cs
- Utilities.cs
- DropShadowBitmapEffect.cs
- ModelVisual3D.cs
- errorpatternmatcher.cs
- XmlCharCheckingReader.cs
- TdsParameterSetter.cs
- PropertyRef.cs
- Effect.cs
- SignedPkcs7.cs
- SoapUnknownHeader.cs
- FrameworkEventSource.cs
- PointAnimationUsingPath.cs
- CachingParameterInspector.cs
- PathGradientBrush.cs
- AmbientLight.cs
- ClientBuildManagerCallback.cs
- ProgressBar.cs
- DashStyle.cs
- RecordManager.cs
- ForEachAction.cs
- BlobPersonalizationState.cs
- FlowLayoutSettings.cs
- TracedNativeMethods.cs
- QueryValue.cs
- QueryAsyncResult.cs
- Bits.cs
- RealProxy.cs
- MetadataFile.cs
- SizeAnimation.cs
- FullTrustAssembly.cs
- DynamicField.cs
- WindowsHyperlink.cs
- XmlSchemaSimpleContent.cs
- SubMenuStyleCollection.cs
- AggregateException.cs
- ShapingWorkspace.cs
- MessageRpc.cs
- Floater.cs
- IDQuery.cs
- XamlVector3DCollectionSerializer.cs
- ClientRuntimeConfig.cs
- CodeConstructor.cs
- DefaultPropertiesToSend.cs
- TextBoxBase.cs
- NavigatingCancelEventArgs.cs
- SemanticAnalyzer.cs
- SliderAutomationPeer.cs
- TemplateKeyConverter.cs
- AsymmetricAlgorithm.cs
- HandlerBase.cs
- IItemProperties.cs
- SizeFConverter.cs
- InfoCardRSACryptoProvider.cs
- CustomSignedXml.cs
- HyperLinkStyle.cs
- RuntimeEnvironment.cs
- PeerName.cs
- SqlNodeAnnotation.cs
- COMException.cs
- ParallelTimeline.cs
- WsdlImporterElementCollection.cs
- BypassElement.cs
- DataObjectMethodAttribute.cs
- _AutoWebProxyScriptEngine.cs
- XmlRootAttribute.cs
- COM2EnumConverter.cs
- XamlTemplateSerializer.cs
- SiteMapHierarchicalDataSourceView.cs
- LinqDataSourceEditData.cs
- DataServiceConfiguration.cs
- CompModSwitches.cs
- LoginUtil.cs
- SpellerInterop.cs
- PlainXmlSerializer.cs
- TimerElapsedEvenArgs.cs
- EntityProviderServices.cs
- ModelTreeEnumerator.cs
- DEREncoding.cs
- PackageRelationshipCollection.cs
- SHA512.cs
- TimeoutException.cs
- ProcessHostServerConfig.cs
- TCEAdapterGenerator.cs
- XPathNodeIterator.cs
- DropDownButton.cs
- XamlVector3DCollectionSerializer.cs
- BindingNavigatorDesigner.cs
- OdbcTransaction.cs
- SyndicationCategory.cs
- PopupRoot.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- EntitySetBaseCollection.cs
- TableLayoutPanel.cs