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
- CanonicalFontFamilyReference.cs
- AttachedPropertyMethodSelector.cs
- ExpressionVisitorHelpers.cs
- QueryBranchOp.cs
- DbCommandTree.cs
- WebPartsSection.cs
- CommonRemoteMemoryBlock.cs
- StringSource.cs
- XslAstAnalyzer.cs
- ServiceModelEnumValidator.cs
- AudioFormatConverter.cs
- DebugView.cs
- OracleTransaction.cs
- DbMetaDataColumnNames.cs
- QilGeneratorEnv.cs
- SqlUserDefinedAggregateAttribute.cs
- ViewBox.cs
- ParallelForEach.cs
- AssemblyFilter.cs
- ScrollBar.cs
- InternalUserCancelledException.cs
- SafeLibraryHandle.cs
- ConditionBrowserDialog.cs
- PixelFormat.cs
- FlowchartDesigner.xaml.cs
- ReadOnlyCollection.cs
- TypeUsage.cs
- GlyphRunDrawing.cs
- DataViewManagerListItemTypeDescriptor.cs
- WebPartEditorApplyVerb.cs
- Enum.cs
- ToolBarTray.cs
- ContractType.cs
- SeekStoryboard.cs
- ComponentDispatcherThread.cs
- Soap12ProtocolReflector.cs
- FixedPage.cs
- SubMenuStyleCollection.cs
- ProjectionCamera.cs
- MemberDomainMap.cs
- securestring.cs
- DataServiceExpressionVisitor.cs
- FaultImportOptions.cs
- ItemChangedEventArgs.cs
- JsonEnumDataContract.cs
- CompilerError.cs
- HttpDebugHandler.cs
- TypeElement.cs
- CheckBox.cs
- PaintEvent.cs
- TimeEnumHelper.cs
- EventRoute.cs
- shaperfactory.cs
- TreeBuilderBamlTranslator.cs
- SqlPersonalizationProvider.cs
- DynamicUpdateCommand.cs
- WindowsScrollBarBits.cs
- MetadataProperty.cs
- XmlAnyElementAttributes.cs
- OutOfProcStateClientManager.cs
- ListViewSortEventArgs.cs
- BaseTemplateBuildProvider.cs
- SuppressMergeCheckAttribute.cs
- BaseTemplateBuildProvider.cs
- DataBinder.cs
- MarshalByValueComponent.cs
- MaterializeFromAtom.cs
- UnsafeNativeMethods.cs
- PageContentCollection.cs
- PageHandlerFactory.cs
- WsdlBuildProvider.cs
- SpeechDetectedEventArgs.cs
- AnnotationHelper.cs
- NativeObjectSecurity.cs
- WebResourceUtil.cs
- MarshalByValueComponent.cs
- WasEndpointConfigContainer.cs
- documentsequencetextcontainer.cs
- MILUtilities.cs
- ContentType.cs
- WebControl.cs
- XmlSchemaObjectTable.cs
- WeakReferenceEnumerator.cs
- DependencyObject.cs
- DateTimeUtil.cs
- WsatEtwTraceListener.cs
- CircleHotSpot.cs
- ObjectViewListener.cs
- PermissionToken.cs
- WebServiceData.cs
- TextLineResult.cs
- StructuredType.cs
- HostProtectionPermission.cs
- CrossAppDomainChannel.cs
- ProtocolsConfigurationHandler.cs
- SkinBuilder.cs
- HttpCachePolicyElement.cs
- WmlListAdapter.cs
- ToolBarButtonClickEvent.cs
- TagNameToTypeMapper.cs