Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- ToolStripDropDownClosingEventArgs.cs
- SelectionUIHandler.cs
- TextFormatter.cs
- xmlsaver.cs
- RadioButtonDesigner.cs
- BaseComponentEditor.cs
- StyleTypedPropertyAttribute.cs
- ToolStripLabel.cs
- ResizeBehavior.cs
- TemplateColumn.cs
- DataGridViewCellStateChangedEventArgs.cs
- dataobject.cs
- DesignTimeParseData.cs
- AssociationSetEnd.cs
- formatter.cs
- SByteConverter.cs
- SqlEnums.cs
- COM2ComponentEditor.cs
- AVElementHelper.cs
- SoapFault.cs
- AnimatedTypeHelpers.cs
- HttpApplication.cs
- RangeValidator.cs
- WebPartConnectionsCancelEventArgs.cs
- ISCIIEncoding.cs
- PeerContact.cs
- ManipulationDevice.cs
- Selector.cs
- LookupBindingPropertiesAttribute.cs
- GenericRootAutomationPeer.cs
- CharacterShapingProperties.cs
- PageBuildProvider.cs
- CodeDirectionExpression.cs
- EventsTab.cs
- SiteOfOriginContainer.cs
- HtmlInputCheckBox.cs
- HijriCalendar.cs
- PixelShader.cs
- ListenerConnectionModeReader.cs
- basevalidator.cs
- CommonGetThemePartSize.cs
- DataGridRow.cs
- DataComponentMethodGenerator.cs
- SiteMembershipCondition.cs
- AuthorizationRule.cs
- QueueProcessor.cs
- OneToOneMappingSerializer.cs
- BitStream.cs
- ReversePositionQuery.cs
- CalendarDateRange.cs
- DefaultMergeHelper.cs
- DrawingAttributesDefaultValueFactory.cs
- MenuStrip.cs
- TemplateContent.cs
- SettingsPropertyCollection.cs
- ZoneIdentityPermission.cs
- DataGridViewCellCollection.cs
- TableCell.cs
- RemotingConfigParser.cs
- FontWeights.cs
- WorkflowMarkupElementEventArgs.cs
- BindingContext.cs
- AxisAngleRotation3D.cs
- DynamicQueryableWrapper.cs
- NodeInfo.cs
- SqlCacheDependencyDatabaseCollection.cs
- UITypeEditor.cs
- TextSpanModifier.cs
- KnownBoxes.cs
- Models.cs
- ContainerCodeDomSerializer.cs
- Partitioner.cs
- ImageFormat.cs
- XmlEnumAttribute.cs
- RealProxy.cs
- CryptoApi.cs
- OracleDataAdapter.cs
- TemplateComponentConnector.cs
- RenameRuleObjectDialog.Designer.cs
- AuthenticationModuleElementCollection.cs
- WindowsGraphicsCacheManager.cs
- BulletDecorator.cs
- ContentValidator.cs
- OLEDB_Util.cs
- AccessDataSourceView.cs
- ObjectList.cs
- XmlObjectSerializerWriteContext.cs
- MetadataImporter.cs
- ReadOnlyDataSource.cs
- HttpProcessUtility.cs
- AddInDeploymentState.cs
- MetadataImporterQuotas.cs
- DocumentsTrace.cs
- XmlValidatingReader.cs
- DragDeltaEventArgs.cs
- Events.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- HashRepartitionStream.cs
- RoleManagerSection.cs
- SqlPersonalizationProvider.cs