Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- UriExt.cs
- WebPartTransformer.cs
- DesignerOptionService.cs
- FunctionParameter.cs
- XmlSchemaSimpleTypeUnion.cs
- BaseUriHelper.cs
- CounterSample.cs
- RawStylusInputReport.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- WindowsListViewItemCheckBox.cs
- EntityKey.cs
- Internal.cs
- CatalogPartChrome.cs
- ToolStripItemDesigner.cs
- metadatamappinghashervisitor.cs
- VectorValueSerializer.cs
- WaveHeader.cs
- BooleanAnimationUsingKeyFrames.cs
- DelegatingStream.cs
- MenuItem.cs
- WebReferencesBuildProvider.cs
- CheckBoxField.cs
- ToolStripDropDownItem.cs
- HasCopySemanticsAttribute.cs
- TemplateInstanceAttribute.cs
- PrimitiveSchema.cs
- MessageSecurityOverTcp.cs
- StrokeNode.cs
- DrawingAttributeSerializer.cs
- AsynchronousChannelMergeEnumerator.cs
- ResourceReferenceExpression.cs
- JapaneseCalendar.cs
- DelegateBodyWriter.cs
- SmiConnection.cs
- TreeWalkHelper.cs
- UnsafeNativeMethods.cs
- CompModHelpers.cs
- BasicHttpSecurityMode.cs
- WebBaseEventKeyComparer.cs
- OleDbError.cs
- UIElementCollection.cs
- SubtreeProcessor.cs
- BinaryObjectReader.cs
- PropertyDescriptorGridEntry.cs
- QilTargetType.cs
- BitmapEffectInputConnector.cs
- Help.cs
- SemanticKeyElement.cs
- Gdiplus.cs
- PrinterUnitConvert.cs
- ChildTable.cs
- Tuple.cs
- Stylesheet.cs
- IBuiltInEvidence.cs
- DocumentEventArgs.cs
- LinkUtilities.cs
- MetadataSection.cs
- VerificationException.cs
- MatrixAnimationBase.cs
- Crc32Helper.cs
- LoginView.cs
- Signature.cs
- TableHeaderCell.cs
- ChtmlPageAdapter.cs
- ReadOnlyPermissionSet.cs
- SerialStream.cs
- HwndAppCommandInputProvider.cs
- SynchronizedInputAdaptor.cs
- RuleSettings.cs
- Queue.cs
- _NativeSSPI.cs
- ObjectDataProvider.cs
- HostingEnvironmentSection.cs
- XmlAttributeProperties.cs
- SeverityFilter.cs
- ToolboxComponentsCreatedEventArgs.cs
- Semaphore.cs
- CategoryGridEntry.cs
- ConsumerConnectionPoint.cs
- LayoutEditorPart.cs
- MemberNameValidator.cs
- Graphics.cs
- MemoryRecordBuffer.cs
- EffectiveValueEntry.cs
- PauseStoryboard.cs
- TreeView.cs
- StyleConverter.cs
- BlockCollection.cs
- Cursor.cs
- IIS7UserPrincipal.cs
- EmissiveMaterial.cs
- RTLAwareMessageBox.cs
- Transform3DGroup.cs
- DbDataRecord.cs
- TableHeaderCell.cs
- XmlRawWriter.cs
- columnmapkeybuilder.cs
- SmiContext.cs
- SID.cs
- SQLInt16Storage.cs