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
- XmlSchemaDocumentation.cs
- DesigntimeLicenseContextSerializer.cs
- embossbitmapeffect.cs
- DataGridCell.cs
- HostedHttpContext.cs
- ObjectStateManagerMetadata.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- OleDbDataAdapter.cs
- NativeStructs.cs
- ToolstripProfessionalRenderer.cs
- ConnectionsZoneAutoFormat.cs
- NativeMethods.cs
- ResourcePool.cs
- ProcessHostConfigUtils.cs
- LabelExpression.cs
- UInt64.cs
- DelegateSerializationHolder.cs
- ChtmlSelectionListAdapter.cs
- SynchronizedDisposablePool.cs
- ListBoxItem.cs
- _SafeNetHandles.cs
- DataMemberAttribute.cs
- _emptywebproxy.cs
- safemediahandle.cs
- SqlCacheDependencyDatabaseCollection.cs
- X509ImageLogo.cs
- SimpleBitVector32.cs
- TransformPattern.cs
- SqlParameterizer.cs
- Typeface.cs
- TextPatternIdentifiers.cs
- TypeHelpers.cs
- SelectionBorderGlyph.cs
- EdmProperty.cs
- Cast.cs
- Point3D.cs
- SymmetricAlgorithm.cs
- TextOnlyOutput.cs
- InitializerFacet.cs
- StateManagedCollection.cs
- HttpHandlerAction.cs
- Types.cs
- AccessViolationException.cs
- CalendarBlackoutDatesCollection.cs
- SqlDataSourceConnectionPanel.cs
- WrapperEqualityComparer.cs
- PlatformCulture.cs
- PlatformNotSupportedException.cs
- HttpCapabilitiesBase.cs
- RuleCache.cs
- EdmFunction.cs
- CorePropertiesFilter.cs
- EditableTreeList.cs
- TypeNameConverter.cs
- DataServiceEntityAttribute.cs
- DataGridParentRows.cs
- DependencyObjectCodeDomSerializer.cs
- AsymmetricSignatureFormatter.cs
- RuleDefinitions.cs
- NamespaceDisplay.xaml.cs
- RectangleF.cs
- WebPartManager.cs
- SmtpLoginAuthenticationModule.cs
- KeyEvent.cs
- PtsHost.cs
- StrongNameKeyPair.cs
- ThrowHelper.cs
- DayRenderEvent.cs
- mactripleDES.cs
- NameService.cs
- KnowledgeBase.cs
- NestedContainer.cs
- HandlerMappingMemo.cs
- AttributeConverter.cs
- CodeEventReferenceExpression.cs
- SHA1Managed.cs
- ContextDataSource.cs
- LineServices.cs
- ISO2022Encoding.cs
- DownloadProgressEventArgs.cs
- CircleHotSpot.cs
- NumericPagerField.cs
- ExtensibleClassFactory.cs
- ReceiveSecurityHeader.cs
- SQlBooleanStorage.cs
- RequestCachingSection.cs
- RuntimeConfigLKG.cs
- AnimatedTypeHelpers.cs
- ListBindingHelper.cs
- OleDbPropertySetGuid.cs
- DockAndAnchorLayout.cs
- BigInt.cs
- AppDomainManager.cs
- PrePrepareMethodAttribute.cs
- PictureBoxDesigner.cs
- SortDescriptionCollection.cs
- PaintEvent.cs
- MediaEntryAttribute.cs
- SafeEventHandle.cs
- ToolStripContentPanel.cs