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
- CalendarItem.cs
- SmiConnection.cs
- GridErrorDlg.cs
- ValuePattern.cs
- HierarchicalDataSourceControl.cs
- HtmlInputPassword.cs
- ContextBase.cs
- ContentValidator.cs
- FontInfo.cs
- EditorPartCollection.cs
- HttpListenerResponse.cs
- _BufferOffsetSize.cs
- UnsafeNativeMethods.cs
- TraceListeners.cs
- WindowClosedEventArgs.cs
- PathSegment.cs
- LazyLoadBehavior.cs
- HyperlinkAutomationPeer.cs
- NavigationPropertyAccessor.cs
- TriState.cs
- SmtpReplyReader.cs
- RequestValidator.cs
- DataRecordInternal.cs
- BinaryConverter.cs
- ListControl.cs
- DynamicPropertyHolder.cs
- TrustLevel.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ContextMenuStripGroupCollection.cs
- HttpRequest.cs
- CorrelationQueryBehavior.cs
- ProviderCommandInfoUtils.cs
- CheckBoxPopupAdapter.cs
- XmlQueryRuntime.cs
- SafeBitVector32.cs
- CodeDirectiveCollection.cs
- ItemChangedEventArgs.cs
- CompilationUnit.cs
- ListViewUpdateEventArgs.cs
- ImageList.cs
- ReferenceSchema.cs
- SmiEventStream.cs
- BamlBinaryReader.cs
- DebugView.cs
- Axis.cs
- SubclassTypeValidatorAttribute.cs
- FromRequest.cs
- ClientSideProviderDescription.cs
- MultiSelectRootGridEntry.cs
- ObjectToken.cs
- DirectoryObjectSecurity.cs
- SymbolDocumentGenerator.cs
- WebPartCancelEventArgs.cs
- HttpClientCertificate.cs
- SiteMap.cs
- X509CertificateValidationMode.cs
- ObjectSet.cs
- DropTarget.cs
- Clipboard.cs
- StreamAsIStream.cs
- DynamicRenderer.cs
- AmbientLight.cs
- FigureParagraph.cs
- COM2FontConverter.cs
- CodeGenHelper.cs
- SystemInformation.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- ZipIOExtraFieldZip64Element.cs
- ConfigurationElementProperty.cs
- SortAction.cs
- IUnknownConstantAttribute.cs
- NativeMethods.cs
- ElapsedEventArgs.cs
- DragCompletedEventArgs.cs
- DecimalConstantAttribute.cs
- OptimisticConcurrencyException.cs
- BaseDataListComponentEditor.cs
- StylusLogic.cs
- TransformValueSerializer.cs
- FacetEnabledSchemaElement.cs
- KeyTimeConverter.cs
- DispatcherTimer.cs
- ImageDrawing.cs
- _HelperAsyncResults.cs
- AnnotationMap.cs
- infer.cs
- DataServiceQueryOfT.cs
- SoapIncludeAttribute.cs
- WebSysDisplayNameAttribute.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- CodeStatementCollection.cs
- NativeCppClassAttribute.cs
- ContractCodeDomInfo.cs
- Transactions.cs
- DesignerOptionService.cs
- UserControlCodeDomTreeGenerator.cs
- CodeTypeMember.cs
- DesigntimeLicenseContextSerializer.cs
- TableStyle.cs
- NetworkInterface.cs