Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- Int64.cs
- SqlConnectionPoolGroupProviderInfo.cs
- HostingEnvironmentException.cs
- SizeConverter.cs
- SafeBitVector32.cs
- Utils.cs
- ContentTextAutomationPeer.cs
- AQNBuilder.cs
- ImpersonationContext.cs
- ErrorWebPart.cs
- WindowsAuthenticationModule.cs
- WindowsProgressbar.cs
- FreezableCollection.cs
- MergeExecutor.cs
- ToolStripOverflowButton.cs
- BaseUriHelper.cs
- ScalarConstant.cs
- X509ChainElement.cs
- RectangleGeometry.cs
- EditorAttribute.cs
- Size3D.cs
- AuthorizationSection.cs
- DesignerActionUIService.cs
- ObjectParameterCollection.cs
- XhtmlBasicControlAdapter.cs
- Renderer.cs
- XmlDocumentSchema.cs
- SelectionUIHandler.cs
- WorkflowMarkupSerializationProvider.cs
- ToolStripDropDown.cs
- PeerCollaboration.cs
- UpdateProgress.cs
- ParenthesizePropertyNameAttribute.cs
- TrackingServices.cs
- ToolBarDesigner.cs
- MimeReflector.cs
- EncoderNLS.cs
- ObjectKeyFrameCollection.cs
- SingleBodyParameterMessageFormatter.cs
- Wildcard.cs
- ContentHostHelper.cs
- WebPartConnectionCollection.cs
- DbModificationClause.cs
- TypeDescriptor.cs
- JsonUriDataContract.cs
- QueryExpr.cs
- DataTableCollection.cs
- OracleDateTime.cs
- WindowsListView.cs
- PKCS1MaskGenerationMethod.cs
- SiteMapPathDesigner.cs
- ListViewItem.cs
- StringTraceRecord.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- Timer.cs
- WmlPhoneCallAdapter.cs
- CacheAxisQuery.cs
- FontStyles.cs
- GeneralTransform3D.cs
- UInt32.cs
- webeventbuffer.cs
- Pkcs9Attribute.cs
- InfoCardSchemas.cs
- SizeAnimationBase.cs
- Transform.cs
- ToolBar.cs
- FlowDocumentReaderAutomationPeer.cs
- StylusDevice.cs
- RequestCachePolicy.cs
- ResXResourceReader.cs
- TagMapCollection.cs
- ButtonFieldBase.cs
- PointLightBase.cs
- XmlArrayAttribute.cs
- Timeline.cs
- SharedPersonalizationStateInfo.cs
- ThousandthOfEmRealDoubles.cs
- HtmlInputSubmit.cs
- ArrayList.cs
- BitmapEffectrendercontext.cs
- XmlAttributeAttribute.cs
- WebCategoryAttribute.cs
- DecimalStorage.cs
- BmpBitmapEncoder.cs
- DataGridColumnHeader.cs
- assertwrapper.cs
- _CookieModule.cs
- TraceFilter.cs
- Viewport3DAutomationPeer.cs
- ClientSideQueueItem.cs
- XmlConvert.cs
- MSAAEventDispatcher.cs
- Util.cs
- ListInitExpression.cs
- RuleProcessor.cs
- Stream.cs
- PageStatePersister.cs
- OleStrCAMarshaler.cs
- EdmItemCollection.cs
- ResourceSet.cs