Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / TemplateBindingExpressionConverter.cs / 1 / TemplateBindingExpressionConverter.cs
/****************************************************************************\ * * File: TemplateBindingExpressionConverter.cs * * Class for serializing a TemplateBindingExpression. * * 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 { ////// Converts a template binding expression into a MarkupExtension. This is used /// during serialization (the serializer native knows how to serialize an ME). /// public class TemplateBindingExpressionConverter: TypeConverter { ////// Returns true for MarkupExtension /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(MarkupExtension)) { return true; } return base.CanConvertTo(context, destinationType); } ////// Converts to a MarkupExtension /// public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(MarkupExtension)) { TemplateBindingExpression templateBindingExpression = value as TemplateBindingExpression; if (templateBindingExpression == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExpression")); return templateBindingExpression.TemplateBindingExtension; } 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. /****************************************************************************\ * * File: TemplateBindingExpressionConverter.cs * * Class for serializing a TemplateBindingExpression. * * 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 { ////// Converts a template binding expression into a MarkupExtension. This is used /// during serialization (the serializer native knows how to serialize an ME). /// public class TemplateBindingExpressionConverter: TypeConverter { ////// Returns true for MarkupExtension /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(MarkupExtension)) { return true; } return base.CanConvertTo(context, destinationType); } ////// Converts to a MarkupExtension /// public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(MarkupExtension)) { TemplateBindingExpression templateBindingExpression = value as TemplateBindingExpression; if (templateBindingExpression == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExpression")); return templateBindingExpression.TemplateBindingExtension; } 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
- EmptyQuery.cs
- SecurityAccessDeniedException.cs
- IntegerValidatorAttribute.cs
- DiagnosticEventProvider.cs
- SoapRpcServiceAttribute.cs
- StringSource.cs
- LinearKeyFrames.cs
- ValidatorCompatibilityHelper.cs
- CachedPathData.cs
- ProviderException.cs
- InputScopeManager.cs
- ProcessModelSection.cs
- XamlSerializerUtil.cs
- _FixedSizeReader.cs
- ClientUtils.cs
- WorkflowMarkupSerializationManager.cs
- ComponentCommands.cs
- XmlHierarchyData.cs
- Transform3DGroup.cs
- WorkerRequest.cs
- DataGridColumn.cs
- DeclarativeCatalogPart.cs
- SoapRpcMethodAttribute.cs
- ScriptBehaviorDescriptor.cs
- CodeEntryPointMethod.cs
- DeferredBinaryDeserializerExtension.cs
- RegexStringValidator.cs
- EnumerationRangeValidationUtil.cs
- CalendarTable.cs
- WindowsAuthenticationEventArgs.cs
- XmlEnumAttribute.cs
- XmlHierarchicalDataSourceView.cs
- ContainerUtilities.cs
- ChtmlTextWriter.cs
- _DisconnectOverlappedAsyncResult.cs
- Int16AnimationUsingKeyFrames.cs
- BamlRecordReader.cs
- RouteData.cs
- KeyboardDevice.cs
- StrongNamePublicKeyBlob.cs
- ProtectedConfigurationProviderCollection.cs
- PenThreadPool.cs
- ConstructorExpr.cs
- SqlCommandBuilder.cs
- StdRegProviderWrapper.cs
- Propagator.JoinPropagator.cs
- IsolatedStorageSecurityState.cs
- CommandBindingCollection.cs
- HostProtectionException.cs
- DoubleMinMaxAggregationOperator.cs
- RequestCacheValidator.cs
- DbMetaDataCollectionNames.cs
- ToolStripSeparator.cs
- ConfigurationManagerHelperFactory.cs
- ZipIOLocalFileHeader.cs
- ClientTargetCollection.cs
- InvalidWMPVersionException.cs
- RC2CryptoServiceProvider.cs
- DataRowExtensions.cs
- Table.cs
- FormatterServicesNoSerializableCheck.cs
- XmlTypeMapping.cs
- HyperLinkColumn.cs
- DetailsViewPagerRow.cs
- PropertyToken.cs
- UserInitiatedRoutedEventPermission.cs
- RequestQueryProcessor.cs
- RoutedUICommand.cs
- SourceInterpreter.cs
- Collection.cs
- ListViewGroupConverter.cs
- NullableBoolConverter.cs
- ReadOnlyMetadataCollection.cs
- HttpPostedFileBase.cs
- HttpProfileBase.cs
- GAC.cs
- ThumbAutomationPeer.cs
- PixelShader.cs
- Point3DAnimationUsingKeyFrames.cs
- LocalValueEnumerator.cs
- XsltCompileContext.cs
- ToolStripContextMenu.cs
- CodeArrayIndexerExpression.cs
- SHA512Managed.cs
- BufferModeSettings.cs
- ImageDrawing.cs
- CLRBindingWorker.cs
- TimelineCollection.cs
- DrawingServices.cs
- XmlSchemaChoice.cs
- HandlerFactoryWrapper.cs
- BitmapImage.cs
- ResourceExpression.cs
- CodeExporter.cs
- SecureEnvironment.cs
- SerializableAttribute.cs
- Fonts.cs
- CompiledQuery.cs
- XamlToRtfWriter.cs
- MenuItemStyleCollection.cs