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
- ObjectSet.cs
- StringConverter.cs
- LicFileLicenseProvider.cs
- TextBlockAutomationPeer.cs
- ColorInterpolationModeValidation.cs
- HealthMonitoringSection.cs
- RectangleHotSpot.cs
- QueryPrefixOp.cs
- DataGridViewColumnCollection.cs
- FrameworkPropertyMetadata.cs
- TextEditorParagraphs.cs
- BevelBitmapEffect.cs
- ConfigXmlElement.cs
- ItemAutomationPeer.cs
- StrokeRenderer.cs
- AllMembershipCondition.cs
- _ListenerRequestStream.cs
- UmAlQuraCalendar.cs
- SerializationAttributes.cs
- MetaType.cs
- SafeHandle.cs
- RotateTransform.cs
- SerializationException.cs
- AllMembershipCondition.cs
- ToolboxItemCollection.cs
- OdbcTransaction.cs
- StylusPlugin.cs
- ClassData.cs
- SqlRowUpdatedEvent.cs
- ControlType.cs
- PersonalizationStateInfoCollection.cs
- AnimatedTypeHelpers.cs
- BrowserCapabilitiesCompiler.cs
- EntityDataSource.cs
- TaskFormBase.cs
- ObjectSelectorEditor.cs
- VirtualDirectoryMapping.cs
- TraceSource.cs
- ScriptReference.cs
- HttpPostProtocolImporter.cs
- GridViewColumn.cs
- Span.cs
- RectKeyFrameCollection.cs
- DBSchemaRow.cs
- Size3D.cs
- ProcessInputEventArgs.cs
- PerfCounters.cs
- Timer.cs
- ProgressBar.cs
- RSAOAEPKeyExchangeFormatter.cs
- Table.cs
- HelpInfo.cs
- ThreadExceptionEvent.cs
- DataContractJsonSerializer.cs
- DockAndAnchorLayout.cs
- CompiledIdentityConstraint.cs
- PriorityChain.cs
- ConvertBinder.cs
- ConfigXmlComment.cs
- httpstaticobjectscollection.cs
- CompositionTarget.cs
- WebService.cs
- XmlAutoDetectWriter.cs
- XmlQueryStaticData.cs
- ToolBarPanel.cs
- DataGridPreparingCellForEditEventArgs.cs
- Helpers.cs
- TextBoxLine.cs
- Help.cs
- BehaviorEditorPart.cs
- CreateParams.cs
- ExpressionNode.cs
- GridProviderWrapper.cs
- XmlAttributes.cs
- SamlAuthorizationDecisionStatement.cs
- DrawTreeNodeEventArgs.cs
- DEREncoding.cs
- HtmlCalendarAdapter.cs
- FontNamesConverter.cs
- TextWriter.cs
- AudioFormatConverter.cs
- LoginNameDesigner.cs
- CustomValidator.cs
- CompModSwitches.cs
- ExpressionEditorSheet.cs
- XmlEnumAttribute.cs
- ColorContextHelper.cs
- ComplexObject.cs
- Parser.cs
- SQLSingleStorage.cs
- VisualStyleInformation.cs
- ScrollBarAutomationPeer.cs
- HostUtils.cs
- MemberCollection.cs
- TextPattern.cs
- XamlSerializer.cs
- DataPagerFieldItem.cs
- PasswordDeriveBytes.cs
- CategoryEditor.cs
- PenThread.cs