Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- WebContext.cs
- SoapIncludeAttribute.cs
- SyndicationContent.cs
- Pair.cs
- PolicyValidator.cs
- InstancePersistenceContext.cs
- DataGridToolTip.cs
- UiaCoreProviderApi.cs
- SiteMapNodeItemEventArgs.cs
- TableStyle.cs
- MaskedTextBox.cs
- ColorTransformHelper.cs
- Context.cs
- NumericExpr.cs
- XmlSerializerFactory.cs
- ResourceReferenceKeyNotFoundException.cs
- MimeReflector.cs
- MailBnfHelper.cs
- RequestCachePolicy.cs
- XmlDictionary.cs
- DefinitionUpdate.cs
- BooleanFunctions.cs
- GC.cs
- DefaultPropertyAttribute.cs
- DataGridCaption.cs
- DetailsViewDeleteEventArgs.cs
- FileLogRecordStream.cs
- XmlReader.cs
- FileCodeGroup.cs
- ChangePassword.cs
- BitmapEffectState.cs
- SqlCacheDependencySection.cs
- CalendarDateRange.cs
- Vector.cs
- DescendentsWalker.cs
- DelayLoadType.cs
- DefaultProxySection.cs
- ResourceSet.cs
- RegistrySecurity.cs
- PriorityChain.cs
- StopRoutingHandler.cs
- SourceItem.cs
- FontSizeConverter.cs
- MatrixTransform3D.cs
- EntitySqlQueryCacheEntry.cs
- EntityViewGenerator.cs
- TypeSource.cs
- RangeValidator.cs
- OpCellTreeNode.cs
- FileLoadException.cs
- OrderedDictionary.cs
- IUnknownConstantAttribute.cs
- Ops.cs
- Point3DConverter.cs
- WebBrowserHelper.cs
- XmlMemberMapping.cs
- StylusPointPropertyUnit.cs
- MatchAttribute.cs
- LockedHandleGlyph.cs
- EncoderExceptionFallback.cs
- TableRow.cs
- TraversalRequest.cs
- SmiMetaData.cs
- _FtpDataStream.cs
- DialogResultConverter.cs
- CommonDialog.cs
- _NestedMultipleAsyncResult.cs
- IsolatedStorageFileStream.cs
- QilTypeChecker.cs
- TimeSpanStorage.cs
- ChameleonKey.cs
- DecoratedNameAttribute.cs
- ErrorTableItemStyle.cs
- RootProfilePropertySettingsCollection.cs
- TemplateXamlTreeBuilder.cs
- ProtocolViolationException.cs
- DSASignatureDeformatter.cs
- ButtonChrome.cs
- CompModSwitches.cs
- SslStream.cs
- DataControlField.cs
- HostUtils.cs
- QuaternionAnimation.cs
- VersionPair.cs
- ErrorTableItemStyle.cs
- QuotedStringFormatReader.cs
- CommentGlyph.cs
- Rect.cs
- CommonDialog.cs
- Image.cs
- Image.cs
- DataGrid.cs
- AliasGenerator.cs
- FieldToken.cs
- ToggleProviderWrapper.cs
- CultureInfoConverter.cs
- TextCompositionEventArgs.cs
- RealizationDrawingContextWalker.cs
- updateconfighost.cs
- UrlAuthorizationModule.cs