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
- RandomNumberGenerator.cs
- ListenerTraceUtility.cs
- ControlsConfig.cs
- ToolboxComponentsCreatedEventArgs.cs
- ExplicitDiscriminatorMap.cs
- SiteMapNodeItemEventArgs.cs
- NodeInfo.cs
- WindowsSlider.cs
- SqlUtil.cs
- RichTextBox.cs
- XmlProcessingInstruction.cs
- GAC.cs
- ISO2022Encoding.cs
- LogLogRecordEnumerator.cs
- KeyValuePairs.cs
- XPathPatternParser.cs
- SequentialOutput.cs
- BlurEffect.cs
- _NestedSingleAsyncResult.cs
- VariableQuery.cs
- InputReferenceExpression.cs
- JpegBitmapEncoder.cs
- DataSourceCache.cs
- DataContractJsonSerializerOperationFormatter.cs
- IsolatedStorageException.cs
- EditingScope.cs
- VariableExpressionConverter.cs
- ZipIOExtraFieldZip64Element.cs
- TdsValueSetter.cs
- OdbcFactory.cs
- Rotation3DKeyFrameCollection.cs
- HtmlDocument.cs
- ChtmlTextWriter.cs
- UserPersonalizationStateInfo.cs
- ApplicationException.cs
- ContainerFilterService.cs
- HttpVersion.cs
- RoleManagerModule.cs
- DataGridColumnStyleMappingNameEditor.cs
- TimersDescriptionAttribute.cs
- SizeF.cs
- XmlUtil.cs
- XmlProcessingInstruction.cs
- NetCodeGroup.cs
- Pool.cs
- RuleSet.cs
- xdrvalidator.cs
- DiscoveryClientDocuments.cs
- CellPartitioner.cs
- _Rfc2616CacheValidators.cs
- DataTableTypeConverter.cs
- PersonalizableAttribute.cs
- AuthenticationModuleElementCollection.cs
- PagesChangedEventArgs.cs
- WebControlAdapter.cs
- DropShadowEffect.cs
- VisualTransition.cs
- HtmlPanelAdapter.cs
- Maps.cs
- RC2.cs
- TemplateParser.cs
- AncillaryOps.cs
- MimePart.cs
- MissingMethodException.cs
- RowUpdatedEventArgs.cs
- DoubleUtil.cs
- EdgeModeValidation.cs
- PageClientProxyGenerator.cs
- Int64Storage.cs
- OdbcException.cs
- MessageDescriptionCollection.cs
- JavaScriptString.cs
- ArithmeticException.cs
- PerformanceCounterManager.cs
- SqlMultiplexer.cs
- UserUseLicenseDictionaryLoader.cs
- ArraySortHelper.cs
- XmlParserContext.cs
- ToolStripMenuItem.cs
- UIHelper.cs
- DoubleIndependentAnimationStorage.cs
- PageBuildProvider.cs
- Control.cs
- DataSourceSelectArguments.cs
- Span.cs
- WebResponse.cs
- Image.cs
- cryptoapiTransform.cs
- CursorInteropHelper.cs
- RIPEMD160.cs
- XamlTemplateSerializer.cs
- XmlSchemaSimpleType.cs
- ToolStripItemEventArgs.cs
- Transform.cs
- AuthenticationModulesSection.cs
- FieldBuilder.cs
- RtType.cs
- BooleanToVisibilityConverter.cs
- XmlSerializationWriter.cs
- ZipFileInfoCollection.cs