Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BamlResourceSerializer.cs
- Stylesheet.cs
- MultiBinding.cs
- DataGridHeaderBorder.cs
- SessionPageStatePersister.cs
- Avt.cs
- EventSource.cs
- XamlRtfConverter.cs
- WebPartHelpVerb.cs
- PropertyPushdownHelper.cs
- WebConfigurationFileMap.cs
- MethodBuilderInstantiation.cs
- MethodImplAttribute.cs
- CompiledQueryCacheKey.cs
- InheritablePropertyChangeInfo.cs
- ContentPropertyAttribute.cs
- DbConnectionInternal.cs
- ExpressionConverter.cs
- MatrixStack.cs
- XmlEntity.cs
- PersistStreamTypeWrapper.cs
- TextCollapsingProperties.cs
- RijndaelCryptoServiceProvider.cs
- DBConcurrencyException.cs
- Int64AnimationUsingKeyFrames.cs
- EpmCustomContentSerializer.cs
- MarkupCompilePass2.cs
- SRDisplayNameAttribute.cs
- FixedDocument.cs
- InputScopeNameConverter.cs
- ConfigurationStrings.cs
- SapiRecoContext.cs
- FlowDocumentPaginator.cs
- DataTableMappingCollection.cs
- SimpleHandlerFactory.cs
- DataGridViewButtonColumn.cs
- SmtpClient.cs
- Tablet.cs
- ComboBox.cs
- CommentEmitter.cs
- ParseHttpDate.cs
- JoinTreeNode.cs
- DecodeHelper.cs
- TraceListeners.cs
- ClientFormsAuthenticationMembershipProvider.cs
- TemplateGroupCollection.cs
- XmlSerializationWriter.cs
- _ConnectionGroup.cs
- IgnoreSectionHandler.cs
- SimpleRecyclingCache.cs
- StyleSheetRefUrlEditor.cs
- TypeSystemProvider.cs
- HttpListenerPrefixCollection.cs
- SymbolMethod.cs
- WsdlWriter.cs
- ParameterCollection.cs
- StringFreezingAttribute.cs
- DelimitedListTraceListener.cs
- RenderDataDrawingContext.cs
- MarkupExtensionSerializer.cs
- OdbcCommand.cs
- AsyncPostBackErrorEventArgs.cs
- DESCryptoServiceProvider.cs
- ActivityBuilderHelper.cs
- InheritanceService.cs
- BulletDecorator.cs
- ListViewSortEventArgs.cs
- XslVisitor.cs
- QueryCacheEntry.cs
- AudioFormatConverter.cs
- SynchronizationScope.cs
- EastAsianLunisolarCalendar.cs
- VisualStyleTypesAndProperties.cs
- RequiredAttributeAttribute.cs
- DtdParser.cs
- OutKeywords.cs
- UInt32.cs
- UnaryNode.cs
- ImageCodecInfoPrivate.cs
- NullReferenceException.cs
- WebZoneDesigner.cs
- EntityStoreSchemaGenerator.cs
- WebReferencesBuildProvider.cs
- WindowsTokenRoleProvider.cs
- DataErrorValidationRule.cs
- SrgsDocumentParser.cs
- Int64.cs
- XmlAttributeOverrides.cs
- TypeNameConverter.cs
- NodeInfo.cs
- Symbol.cs
- PeerEndPoint.cs
- TemplateInstanceAttribute.cs
- SetIterators.cs
- RegexMatch.cs
- ProcessHostServerConfig.cs
- ControlCachePolicy.cs
- TextRangeEditLists.cs
- CheckBoxField.cs
- Span.cs