Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- IteratorFilter.cs
- IndexOutOfRangeException.cs
- ProfileProvider.cs
- GenericTransactionFlowAttribute.cs
- XmlSchemaSequence.cs
- Int32Storage.cs
- CorrelationQueryBehavior.cs
- CodeDirectiveCollection.cs
- SizeFConverter.cs
- Pkcs7Signer.cs
- WmlMobileTextWriter.cs
- RC2.cs
- Point3DAnimationUsingKeyFrames.cs
- SecurityKeyIdentifier.cs
- DataFieldConverter.cs
- ContentTypeSettingClientMessageFormatter.cs
- SoapInteropTypes.cs
- ReliableInputConnection.cs
- ActivityCollectionMarkupSerializer.cs
- FilterableData.cs
- AutomationEvent.cs
- DiscoveryClientDocuments.cs
- XmlQueryStaticData.cs
- Rotation3DKeyFrameCollection.cs
- GridViewSelectEventArgs.cs
- RawUIStateInputReport.cs
- SqlUtil.cs
- IriParsingElement.cs
- HtmlElementEventArgs.cs
- DbTransaction.cs
- TypeConverterBase.cs
- RectConverter.cs
- TagElement.cs
- Codec.cs
- MemoryStream.cs
- EventTrigger.cs
- InvokeFunc.cs
- SystemWebSectionGroup.cs
- panel.cs
- DynamicResourceExtensionConverter.cs
- PowerEase.cs
- PointHitTestResult.cs
- RC2.cs
- OrderedDictionaryStateHelper.cs
- SqlBuilder.cs
- EntityWithChangeTrackerStrategy.cs
- WebPartCatalogAddVerb.cs
- UIHelper.cs
- _SingleItemRequestCache.cs
- ToolStripProgressBar.cs
- AutomationPeer.cs
- MonthCalendar.cs
- SR.cs
- HttpListenerResponse.cs
- PrintController.cs
- MessageDecoder.cs
- PersistNameAttribute.cs
- FigureParaClient.cs
- XamlTypeMapper.cs
- SemanticResultValue.cs
- DateTimeHelper.cs
- TreeNode.cs
- DataBinding.cs
- Point3DConverter.cs
- Matrix3D.cs
- WebBrowsableAttribute.cs
- XmlDictionaryReader.cs
- PageContentAsyncResult.cs
- SqlProvider.cs
- TimeStampChecker.cs
- _UncName.cs
- ItemChangedEventArgs.cs
- APCustomTypeDescriptor.cs
- CodeDomExtensionMethods.cs
- wmiprovider.cs
- DateTimeValueSerializerContext.cs
- WmpBitmapEncoder.cs
- DataGridSortCommandEventArgs.cs
- ScriptingJsonSerializationSection.cs
- WindowsSpinner.cs
- ToolStrip.cs
- InvalidPrinterException.cs
- Int32CAMarshaler.cs
- ProfilePropertyMetadata.cs
- RankException.cs
- PrimaryKeyTypeConverter.cs
- ReferenceService.cs
- DefaultProxySection.cs
- InstanceStoreQueryResult.cs
- SrgsOneOf.cs
- ReflectionPermission.cs
- ObjectListTitleAttribute.cs
- AssertSection.cs
- Options.cs
- InfoCardClaimCollection.cs
- SoapEnumAttribute.cs
- ResolveRequestResponseAsyncResult.cs
- FileUtil.cs
- RecordConverter.cs
- String.cs