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
- Vector3D.cs
- MediaScriptCommandRoutedEventArgs.cs
- WebServicesDescriptionAttribute.cs
- ViewValidator.cs
- DataListItemCollection.cs
- QilInvoke.cs
- DataGridViewRowsRemovedEventArgs.cs
- OleDbReferenceCollection.cs
- Mutex.cs
- DetailsViewPagerRow.cs
- PresentationTraceSources.cs
- TimeZone.cs
- StreamAsIStream.cs
- ObjectListGeneralPage.cs
- ExceptionRoutedEventArgs.cs
- SubtreeProcessor.cs
- UndoEngine.cs
- BulletDecorator.cs
- WindowsPrincipal.cs
- ListViewGroup.cs
- KeyValuePairs.cs
- Configuration.cs
- OdbcInfoMessageEvent.cs
- precedingsibling.cs
- TargetConverter.cs
- CacheManager.cs
- HierarchicalDataBoundControlAdapter.cs
- PropertyStore.cs
- WebPartTracker.cs
- SByte.cs
- ThousandthOfEmRealPoints.cs
- DataGridViewComboBoxColumnDesigner.cs
- OdbcConnectionHandle.cs
- MessageRpc.cs
- Currency.cs
- regiisutil.cs
- SerializationSectionGroup.cs
- SizeValueSerializer.cs
- WebPartUtil.cs
- DataGridViewDataErrorEventArgs.cs
- XMLDiffLoader.cs
- ComplexPropertyEntry.cs
- SqlGatherConsumedAliases.cs
- DataServiceSaveChangesEventArgs.cs
- XmlSchemaSimpleContentExtension.cs
- AtomEntry.cs
- BoundColumn.cs
- InvalidCardException.cs
- ConnectionProviderAttribute.cs
- DataGridViewDataErrorEventArgs.cs
- ApplyImportsAction.cs
- SerialPinChanges.cs
- IncrementalReadDecoders.cs
- QueryAsyncResult.cs
- EventEntry.cs
- IIS7WorkerRequest.cs
- dbdatarecord.cs
- dsa.cs
- XPathNavigatorReader.cs
- ListManagerBindingsCollection.cs
- SortDescription.cs
- ValidationSummary.cs
- TreeNodeCollection.cs
- Thread.cs
- FilteredXmlReader.cs
- ServiceOperationParameter.cs
- MembershipValidatePasswordEventArgs.cs
- SubMenuStyleCollection.cs
- AnimationClock.cs
- AutomationElement.cs
- LogicalExpr.cs
- ProfileServiceManager.cs
- SystemWebCachingSectionGroup.cs
- AssemblyBuilder.cs
- FocusChangedEventArgs.cs
- HotSpotCollection.cs
- BlurEffect.cs
- BrowserCapabilitiesFactory.cs
- ContainerSelectorActiveEvent.cs
- DataGridViewTopLeftHeaderCell.cs
- EncryptedData.cs
- MembershipSection.cs
- BufferBuilder.cs
- DynamicValueConverter.cs
- ByteStreamGeometryContext.cs
- Parser.cs
- DodSequenceMerge.cs
- ScriptResourceInfo.cs
- UpdateException.cs
- ZipIOExtraFieldZip64Element.cs
- OdbcException.cs
- Variant.cs
- SQLInt32Storage.cs
- Debugger.cs
- MethodExpression.cs
- TypedTableHandler.cs
- hwndwrapper.cs
- TextLineBreak.cs
- BrushConverter.cs
- TrackingSection.cs