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
- FormViewUpdatedEventArgs.cs
- ByeOperationCD1AsyncResult.cs
- FirstMatchCodeGroup.cs
- XmlKeywords.cs
- Queue.cs
- SizeF.cs
- CustomAttributeBuilder.cs
- TypefaceMetricsCache.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- UriTemplateHelpers.cs
- XmlSchemaRedefine.cs
- DetailsViewUpdatedEventArgs.cs
- StyleModeStack.cs
- WebException.cs
- StateMachineWorkflow.cs
- HtmlWindowCollection.cs
- CommandHelpers.cs
- ButtonFieldBase.cs
- ExpressionQuoter.cs
- RemoveStoryboard.cs
- WebConfigurationHost.cs
- FontFamily.cs
- ResourceReferenceKeyNotFoundException.cs
- BitVec.cs
- SchemaCompiler.cs
- InstallerTypeAttribute.cs
- OleDbMetaDataFactory.cs
- NamedPermissionSet.cs
- FileDetails.cs
- WindowsStartMenu.cs
- EmptyCollection.cs
- InputLanguageEventArgs.cs
- ButtonChrome.cs
- srgsitem.cs
- HtmlSelect.cs
- SessionViewState.cs
- arclist.cs
- SubMenuStyle.cs
- ProxyWebPart.cs
- CodeConditionStatement.cs
- StateDesignerConnector.cs
- Thickness.cs
- AsymmetricAlgorithm.cs
- SqlDataSourceConfigureSortForm.cs
- HostedTransportConfigurationManager.cs
- BrowserCapabilitiesCodeGenerator.cs
- CodeBinaryOperatorExpression.cs
- WindowProviderWrapper.cs
- ColorConvertedBitmapExtension.cs
- HtmlInputFile.cs
- XPathSelectionIterator.cs
- PaintValueEventArgs.cs
- DomainUpDown.cs
- SqlDataSourceQueryConverter.cs
- SchemaObjectWriter.cs
- DefaultBinder.cs
- GradientBrush.cs
- MediaEntryAttribute.cs
- InteropBitmapSource.cs
- CopyNamespacesAction.cs
- ReflectionHelper.cs
- Literal.cs
- RtfNavigator.cs
- DetectRunnableInstancesTask.cs
- Array.cs
- WebPartsSection.cs
- XmlnsPrefixAttribute.cs
- XPathEmptyIterator.cs
- ListViewInsertionMark.cs
- InvalidCastException.cs
- securitycriticaldata.cs
- TextSpanModifier.cs
- OdbcHandle.cs
- Set.cs
- OdbcConnection.cs
- DecimalStorage.cs
- HotSpot.cs
- Lookup.cs
- ObjectKeyFrameCollection.cs
- PropagatorResult.cs
- CultureTable.cs
- MenuItem.cs
- Container.cs
- DataControlImageButton.cs
- WebBrowserContainer.cs
- ModifiableIteratorCollection.cs
- QuadraticBezierSegment.cs
- QueryableFilterRepeater.cs
- MetricEntry.cs
- ParameterModifier.cs
- CultureTable.cs
- _PooledStream.cs
- CheckBox.cs
- ArcSegment.cs
- SQLBoolean.cs
- SynchronizationHandlesCodeDomSerializer.cs
- DataKeyCollection.cs
- HTTP_SERVICE_CONFIG_URLACL_PARAM.cs
- CodeStatement.cs
- Config.cs