Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Data / PriorityBinding.cs / 1 / 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 [....]/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); } 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
- ApplicationProxyInternal.cs
- EntityDataSourceDesignerHelper.cs
- TextLineResult.cs
- RtfControls.cs
- WinCategoryAttribute.cs
- LogReserveAndAppendState.cs
- CancelEventArgs.cs
- Label.cs
- CachedCompositeFamily.cs
- DownloadProgressEventArgs.cs
- Permission.cs
- DataFormats.cs
- EmbeddedMailObjectsCollection.cs
- AddInActivator.cs
- Odbc32.cs
- UriSection.cs
- PersonalizationDictionary.cs
- ExtendedPropertyDescriptor.cs
- CompiledQueryCacheKey.cs
- MenuItem.cs
- CollectionDataContract.cs
- SQLDecimal.cs
- WebConfigurationHost.cs
- ConfigXmlWhitespace.cs
- SoapTypeAttribute.cs
- HiddenField.cs
- StringInfo.cs
- XmlIlTypeHelper.cs
- UrlMappingCollection.cs
- ScriptMethodAttribute.cs
- SQLBytes.cs
- ErrorEventArgs.cs
- ClrProviderManifest.cs
- ActivityCollectionMarkupSerializer.cs
- VirtualizedItemProviderWrapper.cs
- ChangeBlockUndoRecord.cs
- Matrix.cs
- UndoManager.cs
- WebPartEditorCancelVerb.cs
- EventTrigger.cs
- CheckBoxStandardAdapter.cs
- EndpointReference.cs
- HtmlUtf8RawTextWriter.cs
- IgnoreSectionHandler.cs
- SurrogateEncoder.cs
- EntityDataSourceViewSchema.cs
- StandardToolWindows.cs
- WebScriptServiceHostFactory.cs
- TaiwanLunisolarCalendar.cs
- PersonalizationState.cs
- MarkedHighlightComponent.cs
- MetadataItemEmitter.cs
- CatalogPart.cs
- FileRecordSequence.cs
- UInt16.cs
- DataGridTextBox.cs
- AdornerHitTestResult.cs
- RegexRunner.cs
- remotingproxy.cs
- XmlComplianceUtil.cs
- DesignerImageAdapter.cs
- ConfigurationStrings.cs
- OverlappedAsyncResult.cs
- CompiledQuery.cs
- WebResponse.cs
- ImportCatalogPart.cs
- ProcessManager.cs
- BuildProviderUtils.cs
- ButtonStandardAdapter.cs
- AttributeTable.cs
- FormatVersion.cs
- MenuRenderer.cs
- DesignTimeParseData.cs
- ExtendedProperty.cs
- BooleanExpr.cs
- TypeValidationEventArgs.cs
- EditorPart.cs
- ContentTextAutomationPeer.cs
- XamlTemplateSerializer.cs
- GenerateTemporaryTargetAssembly.cs
- PopupControlService.cs
- CultureInfo.cs
- CommonGetThemePartSize.cs
- LayoutEditorPart.cs
- DataSet.cs
- CompilerErrorCollection.cs
- SocketInformation.cs
- RuleRef.cs
- PageBuildProvider.cs
- WebPartConnectVerb.cs
- OneToOneMappingSerializer.cs
- ImplicitInputBrush.cs
- HtmlTable.cs
- InputLanguage.cs
- Visitors.cs
- UriWriter.cs
- Operator.cs
- ChildChangedEventArgs.cs
- HotSpot.cs
- Evidence.cs