Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / TemplateBindingExtensionConverter.cs / 1 / TemplateBindingExtensionConverter.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: ElementItem.cs // // Contents: Implements a converter to an instance descriptor for // TemplateBindingExtension // // Created: 04/28/2005 [....] // //----------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Windows; using System.Security; namespace System.Windows { ////// Type converter to inform the serialization system how to construct a TemplateBindingExtension from /// an instance. It reports that Property should be used as the first parameter to the constructor. /// public class TemplateBindingExtensionConverter : TypeConverter { ////// Returns true if converting to an InstanceDescriptor /// /// /// ///public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } /// /// Converts to an InstanceDescriptor /// ////// Critical: calls InstanceDescriptor ctor which LinkDemands /// PublicOK: can only make an InstanceDescriptor for TemplateBindingExtension, not an arbitrary class /// [SecurityCritical] public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { if(value == null) throw new ArgumentNullException("value"); TemplateBindingExtension templateBinding = value as TemplateBindingExtension; if(templateBinding == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExtension"), "value"); return new InstanceDescriptor(typeof(TemplateBindingExtension).GetConstructor(new Type[] { typeof(DependencyProperty) }), new object[] { templateBinding.Property }); } return base.ConvertTo(context, culture, value, destinationType); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: ElementItem.cs // // Contents: Implements a converter to an instance descriptor for // TemplateBindingExtension // // Created: 04/28/2005 [....] // //----------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Windows; using System.Security; namespace System.Windows { ////// Type converter to inform the serialization system how to construct a TemplateBindingExtension from /// an instance. It reports that Property should be used as the first parameter to the constructor. /// public class TemplateBindingExtensionConverter : TypeConverter { ////// Returns true if converting to an InstanceDescriptor /// /// /// ///public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } /// /// Converts to an InstanceDescriptor /// ////// Critical: calls InstanceDescriptor ctor which LinkDemands /// PublicOK: can only make an InstanceDescriptor for TemplateBindingExtension, not an arbitrary class /// [SecurityCritical] public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { if(value == null) throw new ArgumentNullException("value"); TemplateBindingExtension templateBinding = value as TemplateBindingExtension; if(templateBinding == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExtension"), "value"); return new InstanceDescriptor(typeof(TemplateBindingExtension).GetConstructor(new Type[] { typeof(DependencyProperty) }), new object[] { templateBinding.Property }); } return base.ConvertTo(context, culture, value, destinationType); } } } // 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
- TextContainer.cs
- FormatConvertedBitmap.cs
- TrustLevel.cs
- BooleanKeyFrameCollection.cs
- SqlGenerator.cs
- MultiByteCodec.cs
- XmlKeywords.cs
- RegexGroupCollection.cs
- SiteMapDataSource.cs
- C14NUtil.cs
- AuditLogLocation.cs
- GeneralTransformGroup.cs
- TextTreeInsertElementUndoUnit.cs
- WindowsEditBox.cs
- TypeDelegator.cs
- BinHexDecoder.cs
- InvokeDelegate.cs
- CopyNamespacesAction.cs
- Size3D.cs
- EntityProviderFactory.cs
- RegexBoyerMoore.cs
- XmlDownloadManager.cs
- TypeResolver.cs
- QilReplaceVisitor.cs
- SemaphoreSlim.cs
- EditCommandColumn.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- BinaryObjectInfo.cs
- ToolStripItemImageRenderEventArgs.cs
- MatrixTransform3D.cs
- ReadOnlyDictionary.cs
- IListConverters.cs
- BaseValidatorDesigner.cs
- ArgumentNullException.cs
- DocobjHost.cs
- SecurityHelper.cs
- _ListenerResponseStream.cs
- SByteStorage.cs
- ResourceReferenceExpression.cs
- ParamArrayAttribute.cs
- LinqDataSourceView.cs
- TextSpan.cs
- TcpTransportSecurity.cs
- ExpandableObjectConverter.cs
- TextEditor.cs
- Currency.cs
- EntitySqlQueryCacheKey.cs
- HtmlShim.cs
- ImageList.cs
- XmlValidatingReaderImpl.cs
- SchemaImporterExtensionElementCollection.cs
- UInt16Converter.cs
- Rect3DValueSerializer.cs
- ContentElement.cs
- ActiveXSite.cs
- Rijndael.cs
- SafeNativeMethods.cs
- VirtualStackFrame.cs
- UpWmlPageAdapter.cs
- DES.cs
- MsmqElementBase.cs
- DiscardableAttribute.cs
- UnsafeNativeMethodsPenimc.cs
- TextEffectResolver.cs
- BaseProcessor.cs
- DefaultMemberAttribute.cs
- MinimizableAttributeTypeConverter.cs
- DropDownList.cs
- EdmConstants.cs
- GetIndexBinder.cs
- ImageMapEventArgs.cs
- CompModSwitches.cs
- ScaleTransform3D.cs
- CoreSwitches.cs
- FixedSOMPageElement.cs
- SqlReorderer.cs
- BrowserTree.cs
- FormViewDeleteEventArgs.cs
- GlobalDataBindingHandler.cs
- SplitterEvent.cs
- Encoding.cs
- HttpServerVarsCollection.cs
- ReferentialConstraintRoleElement.cs
- EditorZoneBase.cs
- RecognizerInfo.cs
- PasswordTextContainer.cs
- FileDocument.cs
- MemberHolder.cs
- SingleObjectCollection.cs
- UITypeEditors.cs
- ServiceProviders.cs
- WindowsGraphicsCacheManager.cs
- DocumentApplicationJournalEntry.cs
- TableLayoutCellPaintEventArgs.cs
- SelectedCellsCollection.cs
- FormsAuthenticationConfiguration.cs
- BindableTemplateBuilder.cs
- Int64Animation.cs
- sqlstateclientmanager.cs
- CompositeTypefaceMetrics.cs