Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- StatusBarAutomationPeer.cs
- SymDocumentType.cs
- ResourceExpressionBuilder.cs
- ObjectSpanRewriter.cs
- WsiProfilesElement.cs
- SoapServerMessage.cs
- SqlVersion.cs
- CompressedStack.cs
- PrintDialog.cs
- ReferenceConverter.cs
- TextBoxBaseDesigner.cs
- QueryStringParameter.cs
- ResourceDefaultValueAttribute.cs
- TemplateColumn.cs
- SymmetricKeyWrap.cs
- SelectionWordBreaker.cs
- ApplicationId.cs
- FrameworkContentElementAutomationPeer.cs
- VisualStyleInformation.cs
- CursorConverter.cs
- ElementUtil.cs
- ListenerTraceUtility.cs
- CachedFontFamily.cs
- ModulesEntry.cs
- XhtmlConformanceSection.cs
- DiscardableAttribute.cs
- XmlSchemaSubstitutionGroup.cs
- PathNode.cs
- EventData.cs
- Content.cs
- RuntimeEnvironment.cs
- PagerSettings.cs
- ExpressionBuilderCollection.cs
- Rotation3D.cs
- OleDbPropertySetGuid.cs
- WebPartExportVerb.cs
- ActivityCodeDomSerializationManager.cs
- XamlToRtfWriter.cs
- AssemblyAttributes.cs
- ipaddressinformationcollection.cs
- Range.cs
- SettingsContext.cs
- FormsAuthenticationEventArgs.cs
- TextRangeEdit.cs
- SimpleApplicationHost.cs
- AsyncOperationManager.cs
- BasicDesignerLoader.cs
- WebPartManagerInternals.cs
- ChannelCacheSettings.cs
- AsymmetricCryptoHandle.cs
- Condition.cs
- CharAnimationUsingKeyFrames.cs
- ObjectViewQueryResultData.cs
- Timer.cs
- InternalResources.cs
- ObjectDataSource.cs
- TextView.cs
- IssuedSecurityTokenParameters.cs
- GenerateHelper.cs
- XPathException.cs
- BrowserCapabilitiesCodeGenerator.cs
- RemoteWebConfigurationHostServer.cs
- Stylesheet.cs
- Manipulation.cs
- OutKeywords.cs
- _AutoWebProxyScriptWrapper.cs
- WebSysDescriptionAttribute.cs
- StylusSystemGestureEventArgs.cs
- PathGeometry.cs
- XmlSchemaInfo.cs
- ExpressionStringBuilder.cs
- FileLogRecordHeader.cs
- AspCompat.cs
- NonSerializedAttribute.cs
- ReversePositionQuery.cs
- ProtocolsSection.cs
- ObjectNotFoundException.cs
- IndexedEnumerable.cs
- WebScriptClientGenerator.cs
- XmlnsCache.cs
- PageAdapter.cs
- Filter.cs
- ContextBase.cs
- TraceLevelStore.cs
- ShutDownListener.cs
- Resources.Designer.cs
- _OSSOCK.cs
- BamlTreeUpdater.cs
- CodeAccessPermission.cs
- OrCondition.cs
- FixedSOMSemanticBox.cs
- WorkflowClientDeliverMessageWrapper.cs
- HtmlForm.cs
- WhitespaceReader.cs
- ConstraintStruct.cs
- MultiByteCodec.cs
- BeginEvent.cs
- DataGridViewSelectedColumnCollection.cs
- TreeViewImageGenerator.cs
- WorkflowViewService.cs