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
- _ScatterGatherBuffers.cs
- ConfigurationPermission.cs
- ClientRoleProvider.cs
- DataKeyCollection.cs
- PolyBezierSegment.cs
- ActivationServices.cs
- ReadWriteSpinLock.cs
- XmlSchemaIdentityConstraint.cs
- ComponentEvent.cs
- EndEvent.cs
- ToolboxItemAttribute.cs
- DoubleUtil.cs
- SQLBinaryStorage.cs
- AdapterUtil.cs
- AttributeProviderAttribute.cs
- GlobalizationAssembly.cs
- EmptyStringExpandableObjectConverter.cs
- RtfNavigator.cs
- DispatcherEventArgs.cs
- PasswordBox.cs
- VirtualDirectoryMappingCollection.cs
- SmiEventSink.cs
- IdentifierService.cs
- CustomError.cs
- RuleInfoComparer.cs
- GroupByExpressionRewriter.cs
- PageSetupDialog.cs
- JapaneseLunisolarCalendar.cs
- HandoffBehavior.cs
- ApplicationInfo.cs
- BindingOperations.cs
- GridProviderWrapper.cs
- ColumnClickEvent.cs
- GACMembershipCondition.cs
- CustomWebEventKey.cs
- DbModificationClause.cs
- CompilationLock.cs
- HotSpot.cs
- WebPartHeaderCloseVerb.cs
- BindingCollection.cs
- _AutoWebProxyScriptWrapper.cs
- StreamingContext.cs
- HttpResponseHeader.cs
- CheckPair.cs
- FontDifferentiator.cs
- FormViewUpdatedEventArgs.cs
- MessageBox.cs
- WorkflowOperationErrorHandler.cs
- MetadataSerializer.cs
- HighContrastHelper.cs
- EntityContainerEmitter.cs
- RunInstallerAttribute.cs
- NetworkStream.cs
- CancellationTokenSource.cs
- BitmapCacheBrush.cs
- EventLogPermissionEntry.cs
- WebConfigurationFileMap.cs
- UnitySerializationHolder.cs
- RemoteCryptoSignHashRequest.cs
- PackWebRequestFactory.cs
- AsnEncodedData.cs
- SoapFault.cs
- ReadWriteObjectLock.cs
- Column.cs
- XamlVector3DCollectionSerializer.cs
- ConditionValidator.cs
- WebPartTransformer.cs
- PopOutPanel.cs
- IconConverter.cs
- EdgeModeValidation.cs
- XamlSerializer.cs
- ListManagerBindingsCollection.cs
- XmlSerializationWriter.cs
- ByteStreamGeometryContext.cs
- DataColumnChangeEvent.cs
- ObjectTypeMapping.cs
- ExpressionQuoter.cs
- HostElement.cs
- DataControlLinkButton.cs
- DynamicPropertyReader.cs
- DesignerView.Commands.cs
- CodeMemberProperty.cs
- RolePrincipal.cs
- StyleReferenceConverter.cs
- XmlComment.cs
- WebFormsRootDesigner.cs
- EmptyElement.cs
- PlatformNotSupportedException.cs
- QueryPageSettingsEventArgs.cs
- LoadItemsEventArgs.cs
- OverflowException.cs
- WriteTimeStream.cs
- HttpCacheVaryByContentEncodings.cs
- XMLUtil.cs
- ComponentConverter.cs
- MessageContractMemberAttribute.cs
- NativeMethods.cs
- smtpconnection.cs
- SoapExtensionReflector.cs
- MaskedTextBoxDesigner.cs