Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / TemplateBindingExpressionConverter.cs / 1305600 / 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
- XmlSerializationReader.cs
- WebPartVerbCollection.cs
- ConstraintStruct.cs
- ComboBoxRenderer.cs
- RankException.cs
- BaseUriHelper.cs
- HtmlCommandAdapter.cs
- ActivityInstanceMap.cs
- LayoutTableCell.cs
- BlurBitmapEffect.cs
- GZipStream.cs
- EventItfInfo.cs
- ExpressionPrefixAttribute.cs
- DataGridViewCellConverter.cs
- FormViewDeleteEventArgs.cs
- KnownTypeAttribute.cs
- RichTextBox.cs
- XmlMessageFormatter.cs
- JsonFormatGeneratorStatics.cs
- LayoutSettings.cs
- HtmlGenericControl.cs
- PaperSize.cs
- DelayDesigner.cs
- WebException.cs
- UnmanagedHandle.cs
- SqlIdentifier.cs
- Propagator.cs
- BuilderPropertyEntry.cs
- __Filters.cs
- CompiledELinqQueryState.cs
- ControlBindingsConverter.cs
- DbMetaDataColumnNames.cs
- ConditionCollection.cs
- FullTextBreakpoint.cs
- WebBrowserHelper.cs
- WindowsGraphics2.cs
- Automation.cs
- XmlValueConverter.cs
- KeySplineConverter.cs
- Triplet.cs
- CompilerState.cs
- TextTreeInsertUndoUnit.cs
- SqlError.cs
- UrlAuthFailedErrorFormatter.cs
- DbDeleteCommandTree.cs
- AbstractDataSvcMapFileLoader.cs
- WorkflowInstanceExtensionCollection.cs
- Base64Stream.cs
- VisualState.cs
- ByteAnimation.cs
- ReceiveSecurityHeader.cs
- PKCS1MaskGenerationMethod.cs
- ClientFormsAuthenticationCredentials.cs
- _LocalDataStoreMgr.cs
- PenContexts.cs
- AffineTransform3D.cs
- RegexReplacement.cs
- OptimizedTemplateContent.cs
- WebBrowserHelper.cs
- SiteMapNodeItem.cs
- ReflectionUtil.cs
- SQLBinaryStorage.cs
- ScriptControlDescriptor.cs
- CustomTypeDescriptor.cs
- BroadcastEventHelper.cs
- ProbeMatchesMessageCD1.cs
- PrinterSettings.cs
- OracleSqlParser.cs
- BevelBitmapEffect.cs
- QueryCacheKey.cs
- EventDescriptor.cs
- ScrollBar.cs
- SerializationInfo.cs
- DiagnosticsElement.cs
- RootContext.cs
- MediaEntryAttribute.cs
- PrePostDescendentsWalker.cs
- ModifyActivitiesPropertyDescriptor.cs
- StoryFragments.cs
- HScrollProperties.cs
- PropertyGridCommands.cs
- ProxyWebPartManager.cs
- EventHandlerList.cs
- User.cs
- QilTargetType.cs
- Config.cs
- SessionEndedEventArgs.cs
- BindingsCollection.cs
- CheckBoxBaseAdapter.cs
- CodeEventReferenceExpression.cs
- NetStream.cs
- TemplateComponentConnector.cs
- OciEnlistContext.cs
- XmlCustomFormatter.cs
- XmlnsDefinitionAttribute.cs
- PropertyToken.cs
- SqlConnectionPoolGroupProviderInfo.cs
- NamespaceEmitter.cs
- ExpressionBuilderCollection.cs
- DesignerListAdapter.cs