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 / TemplateBindingExtensionConverter.cs / 1 / TemplateBindingExtensionConverter.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: ElementItem.cs // // Contents: Implements a converter to an instance descriptor for // TemplateBindingExtension // // Created: 04/28/2005 [....] // //----------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Windows; using System.Security; namespace System.Windows { ////// Type converter to inform the serialization system how to construct a TemplateBindingExtension from /// an instance. It reports that Property should be used as the first parameter to the constructor. /// public class TemplateBindingExtensionConverter : TypeConverter { ////// Returns true if converting to an InstanceDescriptor /// /// /// ///public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } /// /// Converts to an InstanceDescriptor /// ////// Critical: calls InstanceDescriptor ctor which LinkDemands /// PublicOK: can only make an InstanceDescriptor for TemplateBindingExtension, not an arbitrary class /// [SecurityCritical] public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { if(value == null) throw new ArgumentNullException("value"); TemplateBindingExtension templateBinding = value as TemplateBindingExtension; if(templateBinding == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExtension"), "value"); return new InstanceDescriptor(typeof(TemplateBindingExtension).GetConstructor(new Type[] { typeof(DependencyProperty) }), new object[] { templateBinding.Property }); } 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. //------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: ElementItem.cs // // Contents: Implements a converter to an instance descriptor for // TemplateBindingExtension // // Created: 04/28/2005 [....] // //----------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Windows; using System.Security; namespace System.Windows { ////// Type converter to inform the serialization system how to construct a TemplateBindingExtension from /// an instance. It reports that Property should be used as the first parameter to the constructor. /// public class TemplateBindingExtensionConverter : TypeConverter { ////// Returns true if converting to an InstanceDescriptor /// /// /// ///public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } /// /// Converts to an InstanceDescriptor /// ////// Critical: calls InstanceDescriptor ctor which LinkDemands /// PublicOK: can only make an InstanceDescriptor for TemplateBindingExtension, not an arbitrary class /// [SecurityCritical] public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { if(value == null) throw new ArgumentNullException("value"); TemplateBindingExtension templateBinding = value as TemplateBindingExtension; if(templateBinding == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExtension"), "value"); return new InstanceDescriptor(typeof(TemplateBindingExtension).GetConstructor(new Type[] { typeof(DependencyProperty) }), new object[] { templateBinding.Property }); } 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
- DefaultIfEmptyQueryOperator.cs
- DependencyObject.cs
- SecurityTokenResolver.cs
- While.cs
- ResizeGrip.cs
- RotateTransform3D.cs
- StylesEditorDialog.cs
- _ConnectStream.cs
- Simplifier.cs
- UInt32Converter.cs
- DebugControllerThread.cs
- FileCodeGroup.cs
- ChannelBinding.cs
- WhiteSpaceTrimStringConverter.cs
- Synchronization.cs
- SQLByte.cs
- SqlTriggerContext.cs
- DataGridViewElement.cs
- InvalidEnumArgumentException.cs
- ObjRef.cs
- RequestQueryProcessor.cs
- XmlArrayItemAttribute.cs
- DataSourceHelper.cs
- MediaSystem.cs
- XmlILIndex.cs
- BitmapEffect.cs
- SystemDropShadowChrome.cs
- XmlWriterSettings.cs
- _ListenerRequestStream.cs
- SmtpLoginAuthenticationModule.cs
- DataGridViewControlCollection.cs
- CdpEqualityComparer.cs
- EntityTemplateUserControl.cs
- OdbcConnectionOpen.cs
- RadioButtonList.cs
- MeasurementDCInfo.cs
- AxHost.cs
- PointAnimationClockResource.cs
- ObjectAnimationBase.cs
- VariableAction.cs
- CompatibleComparer.cs
- FieldNameLookup.cs
- StandardBindingCollectionElement.cs
- CodeConditionStatement.cs
- SmiEventStream.cs
- InstanceHandle.cs
- BaseProcessor.cs
- NominalTypeEliminator.cs
- FormDocumentDesigner.cs
- WhitespaceRuleLookup.cs
- DocumentViewerHelper.cs
- CodeSnippetExpression.cs
- ClassData.cs
- DataBoundControlHelper.cs
- Int32AnimationBase.cs
- KnownTypeAttribute.cs
- DataSourceConverter.cs
- LineUtil.cs
- listitem.cs
- SqlMethods.cs
- BridgeDataReader.cs
- ToolStripItemImageRenderEventArgs.cs
- PropertyConverter.cs
- Context.cs
- NumberSubstitution.cs
- SecurityUtils.cs
- AuthenticationSection.cs
- CatalogPartChrome.cs
- NewArray.cs
- HttpRuntimeSection.cs
- Socket.cs
- SystemIPv4InterfaceProperties.cs
- TaskExceptionHolder.cs
- PerformanceCounterCategory.cs
- DataTableMappingCollection.cs
- ServiceInfoCollection.cs
- HyperLinkStyle.cs
- NamespaceDisplayAutomationPeer.cs
- XmlCharacterData.cs
- TaiwanCalendar.cs
- ToolStripSeparator.cs
- QilFunction.cs
- PropertyValueChangedEvent.cs
- PersonalizationProvider.cs
- StringBuilder.cs
- XmlSchemaAppInfo.cs
- IODescriptionAttribute.cs
- TableParaClient.cs
- UnauthorizedWebPart.cs
- OlePropertyStructs.cs
- ClrProviderManifest.cs
- StagingAreaInputItem.cs
- AllMembershipCondition.cs
- AsmxEndpointPickerExtension.cs
- ConnectionStringsExpressionBuilder.cs
- PersistChildrenAttribute.cs
- NonClientArea.cs
- TextWriterEngine.cs
- XmlImplementation.cs
- XslAstAnalyzer.cs