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
- CqlLexer.cs
- Cursor.cs
- NameValueSectionHandler.cs
- DBCommand.cs
- CommandCollectionEditor.cs
- CodeArrayCreateExpression.cs
- GetLastErrorDetailsRequest.cs
- UnsafeNativeMethodsTablet.cs
- FontFamily.cs
- Rect3DConverter.cs
- Attribute.cs
- unitconverter.cs
- SecUtil.cs
- CharKeyFrameCollection.cs
- HostedBindingBehavior.cs
- MultiByteCodec.cs
- String.cs
- IMembershipProvider.cs
- NegotiateStream.cs
- TextTabProperties.cs
- SapiRecognizer.cs
- ClockGroup.cs
- VisualBasicReference.cs
- RadioButtonAutomationPeer.cs
- RegexInterpreter.cs
- RetrieveVirtualItemEventArgs.cs
- RequestQueue.cs
- XamlSerializerUtil.cs
- AdPostCacheSubstitution.cs
- NamedObjectList.cs
- WmpBitmapDecoder.cs
- FileNotFoundException.cs
- HtmlWindow.cs
- SafeNativeMethods.cs
- SchemaElement.cs
- versioninfo.cs
- IdnElement.cs
- FixedFlowMap.cs
- PropertyMap.cs
- BitmapEffect.cs
- safex509handles.cs
- TreeNode.cs
- DynamicScriptObject.cs
- InheritanceContextHelper.cs
- MemoryMappedViewStream.cs
- CacheForPrimitiveTypes.cs
- HashAlgorithm.cs
- DuplexSecurityProtocolFactory.cs
- UserControl.cs
- StickyNoteAnnotations.cs
- BrowserCapabilitiesCompiler.cs
- StrongNameKeyPair.cs
- ChtmlMobileTextWriter.cs
- DataObject.cs
- SharedPerformanceCounter.cs
- DelimitedListTraceListener.cs
- DataBinding.cs
- EtwTrace.cs
- DataFormats.cs
- streamingZipPartStream.cs
- SchemaTableOptionalColumn.cs
- EntityDesignerUtils.cs
- DataGridViewCellStyle.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- _LocalDataStoreMgr.cs
- PathFigureCollectionConverter.cs
- XmlSchemaParticle.cs
- RemoteWebConfigurationHostStream.cs
- IImplicitResourceProvider.cs
- UnsafeNativeMethods.cs
- CommandHelpers.cs
- ClientCultureInfo.cs
- TextUtf8RawTextWriter.cs
- ArgIterator.cs
- VisualTreeHelper.cs
- BuildProvider.cs
- XPathNodeInfoAtom.cs
- PageAdapter.cs
- SQLDoubleStorage.cs
- WindowsGrip.cs
- InkCanvasSelection.cs
- Logging.cs
- coordinatorscratchpad.cs
- ClientSettings.cs
- Privilege.cs
- SHA384Managed.cs
- EntryIndex.cs
- DemultiplexingDispatchMessageFormatter.cs
- TextDecorationUnitValidation.cs
- CmsInterop.cs
- ElementMarkupObject.cs
- RegexParser.cs
- DelimitedListTraceListener.cs
- ResourcesGenerator.cs
- coordinatorfactory.cs
- Path.cs
- ConnectionManagementElement.cs
- ScopedKnownTypes.cs
- GenerateScriptTypeAttribute.cs
- ParallelTimeline.cs