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
- Transactions.cs
- SafeCertificateStore.cs
- StylusPointPropertyId.cs
- MultiBinding.cs
- XmlComplianceUtil.cs
- WorkflowDispatchContext.cs
- DependencySource.cs
- DbBuffer.cs
- TreeViewDataItemAutomationPeer.cs
- CodeDOMProvider.cs
- Axis.cs
- SiteMapDesignerDataSourceView.cs
- securitycriticaldataformultiplegetandset.cs
- ServicePrincipalNameElement.cs
- ArrayWithOffset.cs
- Inflater.cs
- EventSinkHelperWriter.cs
- SubstitutionList.cs
- FontFamilyValueSerializer.cs
- DashStyle.cs
- MembershipValidatePasswordEventArgs.cs
- HostVisual.cs
- ExtractedStateEntry.cs
- RewritingSimplifier.cs
- TableLayoutPanelCodeDomSerializer.cs
- SetStoryboardSpeedRatio.cs
- WebRequestModuleElementCollection.cs
- FormViewPagerRow.cs
- StatusBarPanel.cs
- InstallerTypeAttribute.cs
- X509Extension.cs
- TemplateAction.cs
- CodeCastExpression.cs
- Internal.cs
- IdentityModelStringsVersion1.cs
- ComponentResourceKeyConverter.cs
- MetaTableHelper.cs
- DataGridItemEventArgs.cs
- AudioFormatConverter.cs
- ScriptIgnoreAttribute.cs
- SharedDp.cs
- VariantWrapper.cs
- Regex.cs
- MultiAsyncResult.cs
- SessionChannels.cs
- DbConnectionOptions.cs
- Int64KeyFrameCollection.cs
- XamlBrushSerializer.cs
- PrivateFontCollection.cs
- SortQuery.cs
- GradientStop.cs
- ExitEventArgs.cs
- NullableIntMinMaxAggregationOperator.cs
- ZoneLinkButton.cs
- TypedTableBase.cs
- ProcessStartInfo.cs
- StrokeCollection2.cs
- XmlException.cs
- SchemaInfo.cs
- BinHexDecoder.cs
- MethodSignatureGenerator.cs
- SessionStateSection.cs
- DynamicValueConverter.cs
- _ListenerRequestStream.cs
- MarkupExtensionSerializer.cs
- TransactionInformation.cs
- AuthenticationServiceManager.cs
- EnumerableWrapperWeakToStrong.cs
- CacheAxisQuery.cs
- DurableOperationContext.cs
- PartManifestEntry.cs
- HtmlFormParameterWriter.cs
- SubstitutionList.cs
- FromRequest.cs
- FunctionQuery.cs
- CodeTypeOfExpression.cs
- FileDetails.cs
- TypeInitializationException.cs
- SchemaContext.cs
- AuthenticatingEventArgs.cs
- DrawingContextDrawingContextWalker.cs
- DocumentNUp.cs
- DBConcurrencyException.cs
- TypeUtil.cs
- _CookieModule.cs
- _SafeNetHandles.cs
- StylusPointPropertyInfoDefaults.cs
- CodeTypeReference.cs
- ScrollableControl.cs
- RefreshPropertiesAttribute.cs
- XmlQueryTypeFactory.cs
- DataRowComparer.cs
- Guid.cs
- WindowsAuthenticationModule.cs
- CustomCategoryAttribute.cs
- AVElementHelper.cs
- AsyncResult.cs
- WebEncodingValidatorAttribute.cs
- BinaryParser.cs
- ViewCellSlot.cs