Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- AsyncCompletedEventArgs.cs
- ClipboardData.cs
- AbstractExpressions.cs
- ConfigXmlWhitespace.cs
- SR.cs
- LinearQuaternionKeyFrame.cs
- TemplateNodeContextMenu.cs
- DataList.cs
- InplaceBitmapMetadataWriter.cs
- ListViewHitTestInfo.cs
- newinstructionaction.cs
- KeyInterop.cs
- KnownTypes.cs
- IntersectQueryOperator.cs
- XmlSchemaSimpleContentRestriction.cs
- WebPartConnectVerb.cs
- ExceptionUtil.cs
- ObjectListItemCollection.cs
- SqlDataSource.cs
- IpcManager.cs
- WinInet.cs
- IBuiltInEvidence.cs
- DataRelation.cs
- DateTimeUtil.cs
- SQLMoney.cs
- UpdateProgress.cs
- DependencyPropertyHelper.cs
- HttpApplication.cs
- TTSEngineProxy.cs
- PropertyGroupDescription.cs
- DateTimeConstantAttribute.cs
- COMException.cs
- ColorPalette.cs
- InvokeMethodDesigner.xaml.cs
- VariableDesigner.xaml.cs
- DataFieldConverter.cs
- PageThemeParser.cs
- ScriptIgnoreAttribute.cs
- BamlMapTable.cs
- JsonObjectDataContract.cs
- Stack.cs
- OdbcFactory.cs
- SqlNodeAnnotation.cs
- EnumerationRangeValidationUtil.cs
- NotSupportedException.cs
- VirtualDirectoryMapping.cs
- StorageConditionPropertyMapping.cs
- StatusBarPanel.cs
- DBSchemaRow.cs
- InfoCardService.cs
- NativeMethods.cs
- SQLInt64.cs
- XmlSchemaSimpleTypeRestriction.cs
- HttpStreamMessageEncoderFactory.cs
- ContainerCodeDomSerializer.cs
- ExtensionQuery.cs
- MorphHelper.cs
- WrapperEqualityComparer.cs
- Inline.cs
- LineVisual.cs
- FillRuleValidation.cs
- EntityException.cs
- RubberbandSelector.cs
- Function.cs
- TcpProcessProtocolHandler.cs
- FusionWrap.cs
- TypeNameParser.cs
- LazyLoadBehavior.cs
- XmlObjectSerializerWriteContextComplex.cs
- PerformanceCounterManager.cs
- LifetimeMonitor.cs
- NonClientArea.cs
- TemplatedAdorner.cs
- _KerberosClient.cs
- ChannelPool.cs
- MergePropertyDescriptor.cs
- FacetDescription.cs
- HwndHost.cs
- QueryExecutionOption.cs
- ProxyHelper.cs
- RequestCachingSection.cs
- ConsoleTraceListener.cs
- TextRange.cs
- HyperLinkStyle.cs
- WindowsStatusBar.cs
- StyleCollectionEditor.cs
- AggregateNode.cs
- ThrowHelper.cs
- ToolStripItemImageRenderEventArgs.cs
- DirectionalLight.cs
- ThicknessAnimationUsingKeyFrames.cs
- ClientFormsIdentity.cs
- MessageSecurityProtocolFactory.cs
- latinshape.cs
- DocumentAutomationPeer.cs
- SystemIPv4InterfaceProperties.cs
- RoutingExtension.cs
- DefaultExpression.cs
- HtmlShim.cs
- SoapAttributeAttribute.cs