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
- FixedNode.cs
- SqlProfileProvider.cs
- OlePropertyStructs.cs
- InstalledFontCollection.cs
- FilterElement.cs
- HttpClientCertificate.cs
- MaskedTextBox.cs
- SignatureSummaryDialog.cs
- LicenseManager.cs
- ScrollContentPresenter.cs
- Mappings.cs
- BitmapEffectGroup.cs
- BatchParser.cs
- StylusCaptureWithinProperty.cs
- HwndMouseInputProvider.cs
- SafeMemoryMappedViewHandle.cs
- KoreanLunisolarCalendar.cs
- OdbcReferenceCollection.cs
- ReadOnlyDictionary.cs
- NoPersistScope.cs
- HttpRuntimeSection.cs
- CommandEventArgs.cs
- Util.cs
- HttpCacheParams.cs
- RemoteX509AsymmetricSecurityKey.cs
- StringFormat.cs
- SqlConnectionPoolGroupProviderInfo.cs
- FacetChecker.cs
- PlaceHolder.cs
- TemplateComponentConnector.cs
- Path.cs
- AndCondition.cs
- BuildResultCache.cs
- ReliableOutputConnection.cs
- GeneratedCodeAttribute.cs
- EdmValidator.cs
- SoapMessage.cs
- XPathBinder.cs
- NonBatchDirectoryCompiler.cs
- SqlCacheDependency.cs
- CommandHelper.cs
- ImageSource.cs
- LightweightEntityWrapper.cs
- XmlDocument.cs
- FontStretchConverter.cs
- ListViewItemMouseHoverEvent.cs
- EntityDataSourceChangingEventArgs.cs
- SQLBoolean.cs
- RepeaterCommandEventArgs.cs
- SystemColors.cs
- FunctionParameter.cs
- DependencyPropertyAttribute.cs
- BindingRestrictions.cs
- XmlHelper.cs
- NativeCppClassAttribute.cs
- XmlSchemaDatatype.cs
- RotateTransform.cs
- TextSelectionHighlightLayer.cs
- EventItfInfo.cs
- EnumerableRowCollectionExtensions.cs
- ByteStorage.cs
- GridView.cs
- ToggleProviderWrapper.cs
- x509utils.cs
- MSG.cs
- ExecutedRoutedEventArgs.cs
- UserControl.cs
- WinFormsSecurity.cs
- _IPv6Address.cs
- DirectoryObjectSecurity.cs
- BCLDebug.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- ExternalException.cs
- FactoryRecord.cs
- DbException.cs
- StatusBarAutomationPeer.cs
- PingOptions.cs
- WebPartEditorApplyVerb.cs
- Polygon.cs
- TimerElapsedEvenArgs.cs
- util.cs
- InternalMappingException.cs
- SymmetricAlgorithm.cs
- TemplateModeChangedEventArgs.cs
- ServiceMemoryGates.cs
- NonClientArea.cs
- KnownIds.cs
- DocumentPageViewAutomationPeer.cs
- SQlBooleanStorage.cs
- ScriptModule.cs
- PropertyToken.cs
- FloatUtil.cs
- DocumentPageViewAutomationPeer.cs
- ForeignConstraint.cs
- FormsAuthenticationCredentials.cs
- InitializerFacet.cs
- JournalEntry.cs
- BuildProviderUtils.cs
- BindingCompleteEventArgs.cs
- COM2ExtendedTypeConverter.cs