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
- IncrementalHitTester.cs
- LineProperties.cs
- ThreadNeutralSemaphore.cs
- TypeToTreeConverter.cs
- SystemResourceHost.cs
- WaitHandle.cs
- ZoneMembershipCondition.cs
- CollectionBase.cs
- Item.cs
- TypeResolver.cs
- XmlSerializer.cs
- EventMappingSettingsCollection.cs
- GridViewUpdateEventArgs.cs
- AuthenticateEventArgs.cs
- XmlCountingReader.cs
- ProviderMetadata.cs
- ResolveCriteriaApril2005.cs
- Connector.xaml.cs
- TextServicesContext.cs
- EventSinkHelperWriter.cs
- TextParagraphProperties.cs
- ComponentDispatcherThread.cs
- PerfCounterSection.cs
- WebHttpElement.cs
- HttpTransportSecurity.cs
- ControlPaint.cs
- GridViewHeaderRowPresenter.cs
- FontStyle.cs
- TcpPortSharing.cs
- Int16Animation.cs
- WindowsStatic.cs
- BitConverter.cs
- PathFigureCollection.cs
- DataGridViewCellMouseEventArgs.cs
- WebConfigurationHostFileChange.cs
- UTF7Encoding.cs
- PackageProperties.cs
- ErrorsHelper.cs
- AccessDataSource.cs
- ElementAtQueryOperator.cs
- HttpListenerResponse.cs
- MetafileHeader.cs
- AssemblyCollection.cs
- JournalEntryStack.cs
- RecognizedPhrase.cs
- FontUnitConverter.cs
- ListViewPagedDataSource.cs
- MetaColumn.cs
- WpfXamlLoader.cs
- EventsTab.cs
- DesignerWebPartChrome.cs
- ActivityDesignerResources.cs
- EventMappingSettings.cs
- PtsPage.cs
- XPathChildIterator.cs
- ValueOfAction.cs
- ExtenderProvidedPropertyAttribute.cs
- PagesSection.cs
- CollectionViewGroup.cs
- Variant.cs
- Formatter.cs
- X509Extension.cs
- InputReportEventArgs.cs
- SecurityTokenProviderContainer.cs
- EventWaitHandle.cs
- shaperfactoryquerycacheentry.cs
- DoubleUtil.cs
- HatchBrush.cs
- SpecialNameAttribute.cs
- StorageScalarPropertyMapping.cs
- AvtEvent.cs
- EdmComplexTypeAttribute.cs
- util.cs
- ColumnBinding.cs
- DmlSqlGenerator.cs
- CheckBoxBaseAdapter.cs
- AlphaSortedEnumConverter.cs
- XmlNamespaceDeclarationsAttribute.cs
- CodeThrowExceptionStatement.cs
- EntityEntry.cs
- WindowsGraphicsCacheManager.cs
- TouchesOverProperty.cs
- CorrelationManager.cs
- SendKeys.cs
- PartitionerStatic.cs
- Literal.cs
- altserialization.cs
- RegexParser.cs
- NullReferenceException.cs
- SafeProcessHandle.cs
- LongAverageAggregationOperator.cs
- Int64Animation.cs
- ExecutionEngineException.cs
- SqlCommandSet.cs
- Label.cs
- VisemeEventArgs.cs
- ReadOnlyPropertyMetadata.cs
- templategroup.cs
- SubpageParaClient.cs
- WebPartCatalogAddVerb.cs