Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- WindowsUserNameSecurityTokenAuthenticator.cs
- GridViewUpdatedEventArgs.cs
- EditingMode.cs
- SparseMemoryStream.cs
- FreezableDefaultValueFactory.cs
- ProcessingInstructionAction.cs
- FunctionImportElement.cs
- AutomationPattern.cs
- SiteMapSection.cs
- FunctionNode.cs
- ZipIOLocalFileBlock.cs
- DrawToolTipEventArgs.cs
- DbProviderFactories.cs
- DynamicDocumentPaginator.cs
- TimeSpanMinutesConverter.cs
- DataGridViewRowEventArgs.cs
- SignedXml.cs
- HostingMessageProperty.cs
- XmlQueryTypeFactory.cs
- WorkerRequest.cs
- CommonRemoteMemoryBlock.cs
- CustomCredentialPolicy.cs
- FieldMetadata.cs
- DateTimeConstantAttribute.cs
- ConnectionString.cs
- Rotation3DAnimation.cs
- GridView.cs
- DotExpr.cs
- NetSectionGroup.cs
- WriteFileContext.cs
- COM2ColorConverter.cs
- TabletCollection.cs
- SweepDirectionValidation.cs
- UIElementPropertyUndoUnit.cs
- FrameworkElementFactoryMarkupObject.cs
- _PooledStream.cs
- TimeZoneInfo.cs
- XmlSchemaSequence.cs
- ResourcePermissionBaseEntry.cs
- _SslState.cs
- DuplicateDetector.cs
- TouchFrameEventArgs.cs
- FunctionParameter.cs
- StrokeFIndices.cs
- ToolStripRenderer.cs
- ClientSession.cs
- AppendHelper.cs
- DbProviderSpecificTypePropertyAttribute.cs
- SelectionRangeConverter.cs
- DataGridTableCollection.cs
- SchemaElementLookUpTable.cs
- DataControlFieldsEditor.cs
- CommunicationException.cs
- ValidationManager.cs
- RouteItem.cs
- GeneralTransform3DTo2D.cs
- HtmlFormParameterReader.cs
- LabelExpression.cs
- NetworkInformationPermission.cs
- SemanticAnalyzer.cs
- ObjectContextServiceProvider.cs
- DetailsViewUpdateEventArgs.cs
- DataTableReader.cs
- SingleObjectCollection.cs
- Symbol.cs
- BitmapMetadataBlob.cs
- ContextActivityUtils.cs
- WsatTransactionFormatter.cs
- ItemCheckedEvent.cs
- HttpServerVarsCollection.cs
- EntitySqlException.cs
- CounterCreationData.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- NotImplementedException.cs
- BitmapEffectDrawingContent.cs
- ConstructorNeedsTagAttribute.cs
- PkcsUtils.cs
- AttachedPropertyBrowsableAttribute.cs
- RealizationDrawingContextWalker.cs
- XslException.cs
- MatrixValueSerializer.cs
- XpsDocumentEvent.cs
- FtpWebRequest.cs
- RemoteWebConfigurationHostStream.cs
- HtmlElementCollection.cs
- AttachedPropertyMethodSelector.cs
- HideDisabledControlAdapter.cs
- ProcessModelInfo.cs
- XpsFont.cs
- _ConnectStream.cs
- MissingSatelliteAssemblyException.cs
- Cursor.cs
- LOSFormatter.cs
- SoapFormatter.cs
- HostedBindingBehavior.cs
- Graphics.cs
- OdbcException.cs
- CounterCreationData.cs
- ImageAutomationPeer.cs
- ObjectStateFormatter.cs