Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / TemplateBindingExtension.cs / 1305600 / 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))] [MarkupExtensionReturnType(typeof(Object))] 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
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- SiteMapPathDesigner.cs
- DoubleAnimationUsingKeyFrames.cs
- ManagementOptions.cs
- WebPartAuthorizationEventArgs.cs
- PersistenceTask.cs
- BoundConstants.cs
- MetaTableHelper.cs
- ToolboxComponentsCreatingEventArgs.cs
- UpdatePanelControlTrigger.cs
- GridPatternIdentifiers.cs
- DateRangeEvent.cs
- StackBuilderSink.cs
- TraceHandler.cs
- SafeNativeMethods.cs
- DataException.cs
- X509SubjectKeyIdentifierClause.cs
- SelectionProcessor.cs
- StrokeCollectionDefaultValueFactory.cs
- UserControl.cs
- TempFiles.cs
- Run.cs
- Parser.cs
- OleDbTransaction.cs
- MetadataSource.cs
- BrowserCapabilitiesFactoryBase.cs
- AuthenticationService.cs
- ScrollableControl.cs
- NavigateUrlConverter.cs
- CultureSpecificStringDictionary.cs
- TraceData.cs
- Grammar.cs
- SchemaCollectionPreprocessor.cs
- ContextMarshalException.cs
- FieldNameLookup.cs
- ResumeStoryboard.cs
- FaultReason.cs
- Vector.cs
- DefaultAsyncDataDispatcher.cs
- InvariantComparer.cs
- TraceInternal.cs
- HtmlFormAdapter.cs
- KeyboardNavigation.cs
- FrugalMap.cs
- Transform3D.cs
- FormClosedEvent.cs
- ImageSource.cs
- MethodCallExpression.cs
- LicFileLicenseProvider.cs
- FormCollection.cs
- AxisAngleRotation3D.cs
- XmlILAnnotation.cs
- FactoryGenerator.cs
- XPathSelfQuery.cs
- XamlUtilities.cs
- HashJoinQueryOperatorEnumerator.cs
- XmlSchemaIdentityConstraint.cs
- KoreanCalendar.cs
- XmlAnyAttributeAttribute.cs
- HttpContextServiceHost.cs
- RegistrySecurity.cs
- Win32Exception.cs
- ServiceModelReg.cs
- IndexedString.cs
- SQLStringStorage.cs
- ImagingCache.cs
- AccessDataSourceView.cs
- SmiGettersStream.cs
- ConfigUtil.cs
- HtmlTable.cs
- SharedPersonalizationStateInfo.cs
- AssemblySettingAttributes.cs
- ASCIIEncoding.cs
- Stack.cs
- Point.cs
- HitTestDrawingContextWalker.cs
- WebDisplayNameAttribute.cs
- ExecutionEngineException.cs
- SqlMetaData.cs
- PauseStoryboard.cs
- FolderBrowserDialogDesigner.cs
- ScriptingJsonSerializationSection.cs
- ArrayList.cs
- ListViewGroupConverter.cs
- FormViewUpdatedEventArgs.cs
- ScrollEvent.cs
- DependsOnAttribute.cs
- XhtmlBasicValidationSummaryAdapter.cs
- LayoutTableCell.cs
- SpeechSeg.cs
- NameObjectCollectionBase.cs
- Command.cs
- DrawingContext.cs
- ButtonColumn.cs
- ProfilePropertySettingsCollection.cs
- DataGridViewRowConverter.cs
- MaskedTextProvider.cs
- StrongNameUtility.cs
- StorageScalarPropertyMapping.cs
- SamlSubjectStatement.cs