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
- AnnouncementService.cs
- ColumnWidthChangingEvent.cs
- CompilerGeneratedAttribute.cs
- TransformedBitmap.cs
- ValidatorCompatibilityHelper.cs
- AccessibleObject.cs
- FormatStringEditor.cs
- ChildTable.cs
- SqlNotificationEventArgs.cs
- BitmapVisualManager.cs
- ClientConfigurationHost.cs
- QualifierSet.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- OptimizerPatterns.cs
- MediaContext.cs
- XmlCharacterData.cs
- ParameterCollection.cs
- ObjectSecurity.cs
- FieldToken.cs
- EventProviderWriter.cs
- DataTableMapping.cs
- ImageSourceValueSerializer.cs
- WmpBitmapEncoder.cs
- XmlExceptionHelper.cs
- SessionPageStatePersister.cs
- PolyQuadraticBezierSegment.cs
- SrgsToken.cs
- SecurityTokenRequirement.cs
- MILUtilities.cs
- FlowSwitch.cs
- JsonEnumDataContract.cs
- DispatcherSynchronizationContext.cs
- XmlImplementation.cs
- ZeroOpNode.cs
- DbgUtil.cs
- AggregateNode.cs
- ICspAsymmetricAlgorithm.cs
- PeerContact.cs
- FileClassifier.cs
- CalendarButton.cs
- JpegBitmapEncoder.cs
- NamespaceEmitter.cs
- CodeGenHelper.cs
- WpfGeneratedKnownProperties.cs
- ClientUrlResolverWrapper.cs
- StyleCollection.cs
- SchemaNames.cs
- Trace.cs
- RegisteredScript.cs
- SelectionHighlightInfo.cs
- Point3DCollection.cs
- ReadOnlyDataSourceView.cs
- xdrvalidator.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- MetricEntry.cs
- TextTreeTextBlock.cs
- PieceNameHelper.cs
- ImageSource.cs
- Currency.cs
- FragmentQuery.cs
- DataKeyArray.cs
- SqlDataSourceConfigureSortForm.cs
- DataGridViewCellFormattingEventArgs.cs
- FilteredXmlReader.cs
- ScrollItemPatternIdentifiers.cs
- Propagator.JoinPropagator.SubstitutingCloneVisitor.cs
- EntityContainer.cs
- DataGridViewRow.cs
- SignerInfo.cs
- TypedElement.cs
- ClrPerspective.cs
- ClassHandlersStore.cs
- HtmlHead.cs
- CommandSet.cs
- XmlKeywords.cs
- FilterQuery.cs
- SpeakProgressEventArgs.cs
- TimeManager.cs
- RowUpdatingEventArgs.cs
- Animatable.cs
- ZipIOLocalFileDataDescriptor.cs
- OutputCacheSettings.cs
- ListMarkerLine.cs
- ServiceRouteHandler.cs
- DesignerProperties.cs
- EntityDataSourceDataSelection.cs
- CategoryGridEntry.cs
- ProcessHostServerConfig.cs
- BaseParaClient.cs
- SystemMulticastIPAddressInformation.cs
- ResourceDescriptionAttribute.cs
- XmlRootAttribute.cs
- JsonReader.cs
- RepeaterItemCollection.cs
- String.cs
- ClientSponsor.cs
- SocketElement.cs
- PropertyChangedEventArgs.cs
- CodeAccessPermission.cs
- ValidationError.cs