Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Data / PriorityBinding.cs / 1305600 / PriorityBinding.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Defines PriorityBinding object, which stores information // for creating instances of PriorityBindingExpression objects. // // See spec at http://avalon/connecteddata/Specs/Data%20Binding.mht // //--------------------------------------------------------------------------- using System; using System.Collections; using System.Collections.ObjectModel; // Collectionusing System.ComponentModel; using System.Globalization; using System.Windows.Markup; using MS.Internal.Data; using MS.Utility; namespace System.Windows.Data { /// /// Describes a collection of bindings attached to a single property. /// These behave as "priority" bindings, meaning that the property /// receives its value from the first binding in the collection that /// can produce a legal value. /// [ContentProperty("Bindings")] public class PriorityBinding : BindingBase, IAddChild { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- ///Constructor public PriorityBinding() : base() { _bindingCollection = new BindingCollection(this, new BindingCollectionChangedCallback(OnBindingCollectionChanged)); } #region IAddChild ////// Called to Add the object as a Child. /// /// /// Object to add as a child - must have type BindingBase /// void IAddChild.AddChild(Object value) { BindingBase binding = value as BindingBase; if (binding != null) Bindings.Add(binding); else throw new ArgumentException(SR.Get(SRID.ChildHasWrongType, this.GetType().Name, "BindingBase", value.GetType().FullName), "value"); } ////// Called when text appears under the tag in markup /// /// /// Text to Add to the Object /// void IAddChild.AddText(string text) { XamlSerializerUtil.ThrowIfNonWhiteSpaceInAddText(text, this); } #endregion IAddChild //------------------------------------------------------ // // Public Properties // //----------------------------------------------------- ///List of inner bindings [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public CollectionBindings { get { return _bindingCollection; } } /// /// This method is used by TypeDescriptor to determine if this property should /// be serialized. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeBindings() { return (Bindings != null && Bindings.Count > 0); } //------------------------------------------------------ // // Protected Methods // //------------------------------------------------------ ////// Create an appropriate expression for this Binding, to be attached /// to the given DependencyProperty on the given DependencyObject. /// internal override BindingExpressionBase CreateBindingExpressionOverride(DependencyObject target, DependencyProperty dp, BindingExpressionBase owner) { return PriorityBindingExpression.CreateBindingExpression(target, dp, this, owner); } internal override BindingBase CreateClone() { return new PriorityBinding(); } internal override void InitializeClone(BindingBase baseClone, BindingMode mode) { PriorityBinding clone = (PriorityBinding)baseClone; for (int i=0; i<=_bindingCollection.Count; ++i) { clone._bindingCollection.Add(_bindingCollection[i].Clone(mode)); } base.InitializeClone(baseClone, mode); } private void OnBindingCollectionChanged() { CheckSealed(); } //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ BindingCollection _bindingCollection; } } // 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
- ComboBoxItem.cs
- SourceElementsCollection.cs
- PathGeometry.cs
- ThumbButtonInfo.cs
- EmptyQuery.cs
- CodeConditionStatement.cs
- DispatcherBuilder.cs
- DataGridViewCellConverter.cs
- TextRange.cs
- Adorner.cs
- ButtonColumn.cs
- TemplateXamlParser.cs
- VSWCFServiceContractGenerator.cs
- NumericUpDownAcceleration.cs
- GrammarBuilderDictation.cs
- ItemsPresenter.cs
- DiagnosticSection.cs
- OpenFileDialog.cs
- HostingEnvironmentSection.cs
- CompilationLock.cs
- PropertyPath.cs
- MetadataCollection.cs
- XmlMembersMapping.cs
- NamespaceQuery.cs
- CheckBoxList.cs
- MarginsConverter.cs
- WindowsRichEdit.cs
- TypefaceMap.cs
- XamlTemplateSerializer.cs
- BitmapEffectrendercontext.cs
- SchemaNames.cs
- TableLayoutSettings.cs
- SchemaImporterExtensionsSection.cs
- GridViewSortEventArgs.cs
- SqlCacheDependencyDatabase.cs
- TypeResolvingOptionsAttribute.cs
- XmlHierarchyData.cs
- ObjectComplexPropertyMapping.cs
- ContentPlaceHolderDesigner.cs
- SqlIdentifier.cs
- SafeProcessHandle.cs
- TogglePatternIdentifiers.cs
- DataControlFieldCell.cs
- ZipIOExtraFieldElement.cs
- Control.cs
- _LocalDataStoreMgr.cs
- SequenceDesigner.cs
- HttpAsyncResult.cs
- EditorZone.cs
- ClientEventManager.cs
- ExpandableObjectConverter.cs
- DeviceContexts.cs
- BinaryQueryOperator.cs
- IndentTextWriter.cs
- PointAnimationUsingKeyFrames.cs
- DataSetMappper.cs
- PropertyBuilder.cs
- DbDataReader.cs
- InstanceLockException.cs
- EndPoint.cs
- CornerRadius.cs
- XmlCharacterData.cs
- CqlLexer.cs
- TdsParameterSetter.cs
- X509UI.cs
- ClickablePoint.cs
- InvalidContentTypeException.cs
- CodePropertyReferenceExpression.cs
- TypeReference.cs
- OleDbTransaction.cs
- RuleEngine.cs
- XmlWrappingReader.cs
- CustomCredentialPolicy.cs
- FlowLayout.cs
- HtmlDocument.cs
- ObfuscationAttribute.cs
- CommentEmitter.cs
- ThreadPool.cs
- CodeLinePragma.cs
- TemplateKey.cs
- AnimationTimeline.cs
- LayoutEditorPart.cs
- DeclaredTypeValidator.cs
- ActivityTypeResolver.xaml.cs
- MSAAEventDispatcher.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- DesignerHelpers.cs
- AppDomainShutdownMonitor.cs
- Clause.cs
- SafeRightsManagementPubHandle.cs
- SelectedDatesCollection.cs
- AggregatePushdown.cs
- EditingCommands.cs
- MultiSelector.cs
- SqlMethodCallConverter.cs
- InteropAutomationProvider.cs
- DtcInterfaces.cs
- ModelItemDictionary.cs
- _DisconnectOverlappedAsyncResult.cs
- coordinatorfactory.cs