Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / TemplateBindingExtension.cs / 1 / TemplateBindingExtension.cs
/****************************************************************************\ * * File: TemplateBindingExtension.cs * * Class for Xaml markup extension for TemplateBinds that * can be set on the nodes of the Template VisualTree. * * Copyright (C) 2005 by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System; using System.ComponentModel; using System.Windows; using System.Windows.Data; using System.Windows.Markup; namespace System.Windows { ////// Class for Xaml markup extension for TemplateBindings that /// can be set on the nodes of the Template VisualTree. /// [TypeConverter(typeof(TemplateBindingExtensionConverter))] public class TemplateBindingExtension : MarkupExtension { ////// Constructor that takes no parameters /// public TemplateBindingExtension() { } ////// Constructor that takes the resource key that this is a static reference to. /// public TemplateBindingExtension( DependencyProperty property) { if (property != null) { _property = property; } else { throw new ArgumentNullException("property"); } } ////// Return an object that should be set on the targetObject's targetProperty /// for this markup extension. For TemplateBindingExtension, this is the object found in /// a resource dictionary in the current parent chain that is keyed by ResourceKey /// /// ServiceProvider that can be queried for services. ////// The object to set on this property. /// public override object ProvideValue(IServiceProvider serviceProvider) { if (Property == null) { throw new InvalidOperationException(SR.Get(SRID.MarkupExtensionProperty)); } return new TemplateBindingExpression(this); } ////// Property we are binding to /// [ConstructorArgument("property")] public DependencyProperty Property { get { return _property; } set { if (value == null) { throw new ArgumentNullException("value"); } _property = value; } } ////// ValueConverter to interpose between the source and target properties /// [DefaultValue(null)] public IValueConverter Converter { get { return _converter; } set { if (value == null) { throw new ArgumentNullException("value"); } _converter = value; } } ////// ConverterParameter we are binding to /// [DefaultValue(null)] public object ConverterParameter { get { return _parameter; } set { _parameter = value; } } private DependencyProperty _property; private IValueConverter _converter; private object _parameter; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /****************************************************************************\ * * File: TemplateBindingExtension.cs * * Class for Xaml markup extension for TemplateBinds that * can be set on the nodes of the Template VisualTree. * * Copyright (C) 2005 by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System; using System.ComponentModel; using System.Windows; using System.Windows.Data; using System.Windows.Markup; namespace System.Windows { ////// Class for Xaml markup extension for TemplateBindings that /// can be set on the nodes of the Template VisualTree. /// [TypeConverter(typeof(TemplateBindingExtensionConverter))] public class TemplateBindingExtension : MarkupExtension { ////// Constructor that takes no parameters /// public TemplateBindingExtension() { } ////// Constructor that takes the resource key that this is a static reference to. /// public TemplateBindingExtension( DependencyProperty property) { if (property != null) { _property = property; } else { throw new ArgumentNullException("property"); } } ////// Return an object that should be set on the targetObject's targetProperty /// for this markup extension. For TemplateBindingExtension, this is the object found in /// a resource dictionary in the current parent chain that is keyed by ResourceKey /// /// ServiceProvider that can be queried for services. ////// The object to set on this property. /// public override object ProvideValue(IServiceProvider serviceProvider) { if (Property == null) { throw new InvalidOperationException(SR.Get(SRID.MarkupExtensionProperty)); } return new TemplateBindingExpression(this); } ////// Property we are binding to /// [ConstructorArgument("property")] public DependencyProperty Property { get { return _property; } set { if (value == null) { throw new ArgumentNullException("value"); } _property = value; } } ////// ValueConverter to interpose between the source and target properties /// [DefaultValue(null)] public IValueConverter Converter { get { return _converter; } set { if (value == null) { throw new ArgumentNullException("value"); } _converter = value; } } ////// ConverterParameter we are binding to /// [DefaultValue(null)] public object ConverterParameter { get { return _parameter; } set { _parameter = value; } } private DependencyProperty _property; private IValueConverter _converter; private object _parameter; } } // 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
- EntitySqlQueryCacheKey.cs
- ValidationError.cs
- SequentialUshortCollection.cs
- _SpnDictionary.cs
- XmlParserContext.cs
- HostProtectionPermission.cs
- CroppedBitmap.cs
- TableLayoutPanelCellPosition.cs
- SurrogateEncoder.cs
- DataGridRowsPresenter.cs
- TextRenderer.cs
- IfAction.cs
- RegisteredHiddenField.cs
- Viewport2DVisual3D.cs
- HttpVersion.cs
- BulletedList.cs
- TextElement.cs
- TemplateKey.cs
- PropertyTabAttribute.cs
- MenuItemCollection.cs
- DataGridViewRowConverter.cs
- InvalidDataException.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- SqlUDTStorage.cs
- Pen.cs
- SQLResource.cs
- Triangle.cs
- CustomAttribute.cs
- WebPartVerbsEventArgs.cs
- VirtualizingPanel.cs
- WindowsListViewItemStartMenu.cs
- MemberNameValidator.cs
- DateTimeOffsetStorage.cs
- ServiceHostingEnvironmentSection.cs
- TraceFilter.cs
- InternalControlCollection.cs
- AppDomainUnloadedException.cs
- MetadataSource.cs
- mediaclock.cs
- FeatureSupport.cs
- OleDbStruct.cs
- GiveFeedbackEventArgs.cs
- FrameworkElementFactoryMarkupObject.cs
- InfiniteIntConverter.cs
- VectorKeyFrameCollection.cs
- PassportAuthenticationEventArgs.cs
- MsmqBindingMonitor.cs
- Int16Animation.cs
- PackageProperties.cs
- ADMembershipProvider.cs
- TypeBrowserDialog.cs
- SubtreeProcessor.cs
- ReferentialConstraintRoleElement.cs
- SafeCloseHandleCritical.cs
- SqlDependencyUtils.cs
- FilterableAttribute.cs
- DataGridViewDataErrorEventArgs.cs
- _NegoStream.cs
- DataBindingCollectionEditor.cs
- ExpressionBindingCollection.cs
- XmlSchemaSimpleTypeList.cs
- EndPoint.cs
- EdmMember.cs
- FastPropertyAccessor.cs
- XmlSchemaInclude.cs
- SQLChars.cs
- StylusPlugin.cs
- WebPartMenuStyle.cs
- UrlPath.cs
- DesigntimeLicenseContext.cs
- ProcessModelInfo.cs
- UInt16Storage.cs
- OracleBFile.cs
- DrawingContextDrawingContextWalker.cs
- XamlTypeWithExplicitNamespace.cs
- CommandConverter.cs
- HostProtectionException.cs
- OpacityConverter.cs
- SubMenuStyleCollection.cs
- Ref.cs
- TraceListeners.cs
- DefaultObjectMappingItemCollection.cs
- RectValueSerializer.cs
- SchemaImporter.cs
- RestHandlerFactory.cs
- DecimalConstantAttribute.cs
- LinearGradientBrush.cs
- SafeReversePInvokeHandle.cs
- RemotingException.cs
- BinaryMethodMessage.cs
- PermissionToken.cs
- TrackingMemoryStream.cs
- WebControlParameterProxy.cs
- CommandID.cs
- CatalogZone.cs
- SparseMemoryStream.cs
- PackageRelationship.cs
- XamlBrushSerializer.cs
- ErrorHandler.cs
- ToolboxItem.cs