Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- LookupBindingPropertiesAttribute.cs
- CultureInfo.cs
- DetailsViewPagerRow.cs
- ErrorWebPart.cs
- QueuePropertyVariants.cs
- XmlSchemaGroup.cs
- ElementUtil.cs
- RoutedEventHandlerInfo.cs
- ListViewDataItem.cs
- StretchValidation.cs
- TargetConverter.cs
- WindowsHyperlink.cs
- ArraySegment.cs
- XPathMessageFilterElementComparer.cs
- CodeDOMUtility.cs
- DataGridViewComboBoxCell.cs
- ActivityInterfaces.cs
- CodeTypeReferenceExpression.cs
- DesignBindingEditor.cs
- CodeAttributeArgumentCollection.cs
- Scheduler.cs
- ExpandCollapsePattern.cs
- DrawingContextDrawingContextWalker.cs
- XPathDocumentBuilder.cs
- UniqueIdentifierService.cs
- ScriptMethodAttribute.cs
- TextTreeInsertElementUndoUnit.cs
- HtmlInputReset.cs
- FormViewPageEventArgs.cs
- SoundPlayerAction.cs
- CreateParams.cs
- ResourceContainerWrapper.cs
- SQlBooleanStorage.cs
- TextPatternIdentifiers.cs
- DocumentPage.cs
- ButtonColumn.cs
- ArrayElementGridEntry.cs
- SmiSettersStream.cs
- CodeMemberEvent.cs
- Italic.cs
- FilterQuery.cs
- StringUtil.cs
- AdCreatedEventArgs.cs
- HuffModule.cs
- MessageDroppedTraceRecord.cs
- HwndKeyboardInputProvider.cs
- WebPartCloseVerb.cs
- XmlSchemaSubstitutionGroup.cs
- DataRow.cs
- DefaultCommandConverter.cs
- SkewTransform.cs
- CellRelation.cs
- SystemEvents.cs
- DefaultWorkflowSchedulerService.cs
- ButtonField.cs
- StrongName.cs
- ServiceCredentialsSecurityTokenManager.cs
- TextRunProperties.cs
- DocumentCollection.cs
- XMLSchema.cs
- DataBindingList.cs
- ScrollEventArgs.cs
- RegisterInfo.cs
- SpanIndex.cs
- DockAndAnchorLayout.cs
- Animatable.cs
- TableRow.cs
- WebHttpBinding.cs
- Activity.cs
- MultiSelector.cs
- HighlightVisual.cs
- TextStore.cs
- XmlDocument.cs
- CommandLineParser.cs
- ScriptHandlerFactory.cs
- RadioButtonFlatAdapter.cs
- DataGridViewIntLinkedList.cs
- RunInstallerAttribute.cs
- SmiRecordBuffer.cs
- XslCompiledTransform.cs
- RSACryptoServiceProvider.cs
- ProcessStartInfo.cs
- EqualityArray.cs
- BasicBrowserDialog.cs
- DataGridRowClipboardEventArgs.cs
- TextEditorTables.cs
- InputProcessorProfilesLoader.cs
- DataGridViewImageCell.cs
- FileReservationCollection.cs
- RawStylusInputReport.cs
- Label.cs
- WindowsFormsSectionHandler.cs
- MemberPath.cs
- PassportPrincipal.cs
- FrameworkPropertyMetadata.cs
- LongSumAggregationOperator.cs
- DrawListViewItemEventArgs.cs
- Internal.cs
- CustomAttributeSerializer.cs
- CalculatedColumn.cs