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
- pingexception.cs
- SetterBase.cs
- XmlArrayItemAttribute.cs
- XamlInt32CollectionSerializer.cs
- XmlSchemaComplexContentRestriction.cs
- KeyToListMap.cs
- MultitargetUtil.cs
- remotingproxy.cs
- XmlEventCache.cs
- VerticalAlignConverter.cs
- WebPartAddingEventArgs.cs
- RectAnimationUsingKeyFrames.cs
- x509store.cs
- HtmlTableCellCollection.cs
- AppDomainResourcePerfCounters.cs
- WebPartEditorOkVerb.cs
- DirectoryRootQuery.cs
- ButtonBaseAdapter.cs
- AppDomainShutdownMonitor.cs
- InstalledVoice.cs
- DetailsViewUpdatedEventArgs.cs
- RenderCapability.cs
- Native.cs
- RepeatInfo.cs
- Interlocked.cs
- OracleParameterBinding.cs
- CustomPopupPlacement.cs
- ProtectedConfigurationSection.cs
- MaterialCollection.cs
- webbrowsersite.cs
- StringPropertyBuilder.cs
- ReversePositionQuery.cs
- WebPartEditorOkVerb.cs
- MouseActionValueSerializer.cs
- Token.cs
- CanonicalXml.cs
- HttpPostedFile.cs
- SiteMapNodeItemEventArgs.cs
- TextProperties.cs
- MobileSysDescriptionAttribute.cs
- DbSourceParameterCollection.cs
- XmlConvert.cs
- SharedPerformanceCounter.cs
- DataGridViewColumnConverter.cs
- TargetConverter.cs
- FileInfo.cs
- CroppedBitmap.cs
- SoapSchemaExporter.cs
- DetailsViewActionList.cs
- CommandLineParser.cs
- SafeMarshalContext.cs
- TypeLibConverter.cs
- ListBoxItem.cs
- EntityDataSourceView.cs
- AssertSection.cs
- Accessors.cs
- SqlDependencyListener.cs
- FixedPageAutomationPeer.cs
- MatcherBuilder.cs
- CertificateElement.cs
- DateTimeOffset.cs
- StrokeNodeData.cs
- RandomDelayQueuedSendsAsyncResult.cs
- CodeSpit.cs
- WsdlImporterElement.cs
- PipeConnection.cs
- SessionStateUtil.cs
- RealizedColumnsBlock.cs
- TypeProvider.cs
- AspProxy.cs
- DataList.cs
- OdbcConnection.cs
- MiniConstructorInfo.cs
- LazyTextWriterCreator.cs
- FlowSwitchDesigner.xaml.cs
- IERequestCache.cs
- ThreadInterruptedException.cs
- WebBrowserBase.cs
- DataGridViewLinkCell.cs
- CacheRequest.cs
- PathFigureCollectionValueSerializer.cs
- DbCommandTree.cs
- ConfigXmlComment.cs
- ConfigurationManagerInternal.cs
- SqlStream.cs
- WarningException.cs
- GrowingArray.cs
- PageCodeDomTreeGenerator.cs
- ByteFacetDescriptionElement.cs
- SapiRecoContext.cs
- Deflater.cs
- ScriptReference.cs
- PathFigureCollectionValueSerializer.cs
- RelationshipNavigation.cs
- SchemaNotation.cs
- DataShape.cs
- CompilerHelpers.cs
- FormViewRow.cs
- StateChangeEvent.cs
- XmlAttributeAttribute.cs