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
- DebugView.cs
- SizeFConverter.cs
- FontStyles.cs
- RegexCompilationInfo.cs
- safesecurityhelperavalon.cs
- BooleanKeyFrameCollection.cs
- GeometryHitTestResult.cs
- GroupBoxAutomationPeer.cs
- PeerNearMe.cs
- MachineSettingsSection.cs
- ImageCodecInfo.cs
- HttpResponse.cs
- ResourceExpressionEditor.cs
- GridEntryCollection.cs
- SHA256Managed.cs
- LineBreak.cs
- LongAverageAggregationOperator.cs
- ResolvedKeyFrameEntry.cs
- HelpProvider.cs
- TreeView.cs
- RootProfilePropertySettingsCollection.cs
- ImageList.cs
- ExpressionUtilities.cs
- CryptoApi.cs
- SemanticAnalyzer.cs
- OleDbParameter.cs
- XmlTextReader.cs
- SiteMapNodeItem.cs
- PrintController.cs
- GatewayIPAddressInformationCollection.cs
- GeneralTransform2DTo3DTo2D.cs
- RelationshipEnd.cs
- SelectionItemProviderWrapper.cs
- Int32EqualityComparer.cs
- DBConcurrencyException.cs
- OutOfMemoryException.cs
- SecurityManager.cs
- HwndSourceKeyboardInputSite.cs
- BoundPropertyEntry.cs
- Fonts.cs
- MessagePropertyAttribute.cs
- Point3DAnimation.cs
- RegionData.cs
- LogManagementAsyncResult.cs
- GeometryDrawing.cs
- QueryOpeningEnumerator.cs
- HtmlTitle.cs
- XpsSerializationException.cs
- CharAnimationUsingKeyFrames.cs
- _KerberosClient.cs
- ProviderException.cs
- ServicesUtilities.cs
- SqlError.cs
- ActivityExecutor.cs
- WebResourceUtil.cs
- ScriptControlDescriptor.cs
- DataTrigger.cs
- WindowsBrush.cs
- SafeNativeMemoryHandle.cs
- DesignerActionList.cs
- MDIClient.cs
- StopStoryboard.cs
- LayoutUtils.cs
- FileRecordSequenceHelper.cs
- Condition.cs
- WebControlAdapter.cs
- MenuItem.cs
- GrammarBuilderPhrase.cs
- ScriptModule.cs
- FixedPageAutomationPeer.cs
- TabControl.cs
- TextLineBreak.cs
- MailAddress.cs
- XmlDeclaration.cs
- TypeTypeConverter.cs
- DetailsViewInsertEventArgs.cs
- LogEntry.cs
- VirtualizedItemProviderWrapper.cs
- XmlCustomFormatter.cs
- CodeExporter.cs
- VisualCollection.cs
- TableLayoutColumnStyleCollection.cs
- SQLInt32.cs
- DrawingContext.cs
- WebPartConnectionsEventArgs.cs
- ReadWriteSpinLock.cs
- ToolConsole.cs
- Formatter.cs
- TransformProviderWrapper.cs
- MappingItemCollection.cs
- MouseActionValueSerializer.cs
- BlurBitmapEffect.cs
- ThemeDictionaryExtension.cs
- AttributeData.cs
- XmlSchemaExporter.cs
- BooleanKeyFrameCollection.cs
- WindowsListBox.cs
- MatrixTransform.cs
- PathFigureCollection.cs
- FileLogRecordEnumerator.cs