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
- CharUnicodeInfo.cs
- NativeMethods.cs
- NotifyParentPropertyAttribute.cs
- WebPageTraceListener.cs
- CollaborationHelperFunctions.cs
- Compress.cs
- XmlSchemaInfo.cs
- ACE.cs
- TextOptionsInternal.cs
- DataExpression.cs
- ACL.cs
- LineGeometry.cs
- SqlDataSourceConnectionPanel.cs
- SqlServices.cs
- CreateParams.cs
- SqlCacheDependencySection.cs
- DynamicHyperLink.cs
- TrackingMemoryStream.cs
- HttpProtocolReflector.cs
- TabRenderer.cs
- ACE.cs
- CardSpaceException.cs
- SortQuery.cs
- DocComment.cs
- PropertyDescriptorCollection.cs
- CursorInteropHelper.cs
- Image.cs
- TraceListener.cs
- versioninfo.cs
- CreatingCookieEventArgs.cs
- NumberSubstitution.cs
- WebAdminConfigurationHelper.cs
- PathFigure.cs
- GridViewRow.cs
- CompensatableSequenceActivity.cs
- DataGridViewTextBoxCell.cs
- SqlCaseSimplifier.cs
- DataListItemCollection.cs
- WizardForm.cs
- CollectionContainer.cs
- Parallel.cs
- TreeWalkHelper.cs
- PathBox.cs
- ApplicationBuildProvider.cs
- StringValueConverter.cs
- TrackingMemoryStreamFactory.cs
- SystemBrushes.cs
- WindowsBrush.cs
- ToolboxItemCollection.cs
- HTTPNotFoundHandler.cs
- WindowsTab.cs
- XmlSchemaValidationException.cs
- RectAnimationBase.cs
- ImageSourceTypeConverter.cs
- DecimalAnimation.cs
- ExpressionBinding.cs
- DataGridViewRowHeaderCell.cs
- SendMailErrorEventArgs.cs
- XhtmlTextWriter.cs
- GenerateTemporaryTargetAssembly.cs
- XmlSchemaSimpleTypeRestriction.cs
- DesignerActionMethodItem.cs
- DataGridState.cs
- EdmSchemaAttribute.cs
- Events.cs
- SqlBulkCopy.cs
- UITypeEditor.cs
- RegexStringValidatorAttribute.cs
- ParameterEditorUserControl.cs
- TransformPatternIdentifiers.cs
- ProfileSection.cs
- TabRenderer.cs
- SessionEndedEventArgs.cs
- BamlLocalizer.cs
- Debugger.cs
- TypeBuilderInstantiation.cs
- ZoneIdentityPermission.cs
- WebSysDisplayNameAttribute.cs
- OutOfProcStateClientManager.cs
- FlowDocumentView.cs
- GuidConverter.cs
- ExtensionQuery.cs
- Vars.cs
- SocketException.cs
- BindingNavigator.cs
- DynamicResourceExtensionConverter.cs
- Relationship.cs
- PackageRelationshipSelector.cs
- unsafeIndexingFilterStream.cs
- DiscoveryMessageProperty.cs
- BinaryFormatterSinks.cs
- Int32Rect.cs
- QualifiedCellIdBoolean.cs
- DataBinder.cs
- Decoder.cs
- RowBinding.cs
- ObservableCollection.cs
- SamlSecurityToken.cs
- ClosureBinding.cs
- comcontractssection.cs