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
- columnmapfactory.cs
- StylusOverProperty.cs
- NativeCompoundFileAPIs.cs
- BrowserCapabilitiesCompiler.cs
- SelectionProviderWrapper.cs
- HttpContext.cs
- NominalTypeEliminator.cs
- RecipientInfo.cs
- TableLayoutStyleCollection.cs
- FixedSOMLineRanges.cs
- AnonymousIdentificationModule.cs
- PropertiesTab.cs
- SqlFunctionAttribute.cs
- MetabaseServerConfig.cs
- MaskedTextBox.cs
- TextPointerBase.cs
- FormViewDesigner.cs
- StickyNoteHelper.cs
- ResourceBinder.cs
- _IPv6Address.cs
- DataBoundControlHelper.cs
- SqlDependencyUtils.cs
- DPAPIProtectedConfigurationProvider.cs
- CachingHintValidation.cs
- DataTableExtensions.cs
- UshortList2.cs
- AsyncCompletedEventArgs.cs
- IRCollection.cs
- TextEditorSpelling.cs
- SequentialUshortCollection.cs
- AddInSegmentDirectoryNotFoundException.cs
- PrintDialog.cs
- ReferentialConstraint.cs
- _emptywebproxy.cs
- VisualStyleElement.cs
- TextEditorParagraphs.cs
- RootBuilder.cs
- SessionEndingCancelEventArgs.cs
- ItemTypeToolStripMenuItem.cs
- LinqDataSourceContextData.cs
- ProxyElement.cs
- DetailsViewInsertEventArgs.cs
- EntityParameterCollection.cs
- ColorPalette.cs
- SelectionEditingBehavior.cs
- XPathNodePointer.cs
- NativeMethods.cs
- CursorConverter.cs
- SynchronousChannelMergeEnumerator.cs
- OdbcHandle.cs
- HMACSHA512.cs
- ByteRangeDownloader.cs
- ManagementNamedValueCollection.cs
- D3DImage.cs
- TextSimpleMarkerProperties.cs
- InputScope.cs
- OracleRowUpdatedEventArgs.cs
- QueryResponse.cs
- TreeViewItemAutomationPeer.cs
- Int32CAMarshaler.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- TcpAppDomainProtocolHandler.cs
- OverflowException.cs
- CurrentTimeZone.cs
- SubstitutionList.cs
- CancelEventArgs.cs
- Simplifier.cs
- HyperLinkDataBindingHandler.cs
- Speller.cs
- OrderedDictionary.cs
- DictionaryEntry.cs
- CompensateDesigner.cs
- SignatureDescription.cs
- XmlDataSourceView.cs
- TextBox.cs
- ParseHttpDate.cs
- Stackframe.cs
- ListViewHitTestInfo.cs
- MarkupWriter.cs
- FixedDocument.cs
- CodeConditionStatement.cs
- WaitHandleCannotBeOpenedException.cs
- XslAstAnalyzer.cs
- SerialErrors.cs
- AccessKeyManager.cs
- ToolStripPanelRenderEventArgs.cs
- WmpBitmapDecoder.cs
- UIElementPropertyUndoUnit.cs
- InvalidOperationException.cs
- FilteredAttributeCollection.cs
- MulticastOption.cs
- UserValidatedEventArgs.cs
- SafeMarshalContext.cs
- mediaeventargs.cs
- SoapElementAttribute.cs
- SymLanguageType.cs
- XmlSchemaDatatype.cs
- SchemaSetCompiler.cs
- DeviceContexts.cs
- RangeValuePattern.cs