Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- InertiaExpansionBehavior.cs
- SizeFConverter.cs
- TripleDESCryptoServiceProvider.cs
- QueryOptionExpression.cs
- ImageConverter.cs
- SafeCancelMibChangeNotify.cs
- EndpointAddressElementBase.cs
- TemporaryBitmapFile.cs
- TextSearch.cs
- PageStatePersister.cs
- RTLAwareMessageBox.cs
- WebControlAdapter.cs
- TextServicesCompartmentContext.cs
- TreePrinter.cs
- WizardForm.cs
- FormatSettings.cs
- ProcessHostMapPath.cs
- UnionQueryOperator.cs
- JoinCqlBlock.cs
- ObjectReferenceStack.cs
- DetailsViewRow.cs
- TaiwanLunisolarCalendar.cs
- DebugView.cs
- WindowsUpDown.cs
- InstallerTypeAttribute.cs
- TypeDependencyAttribute.cs
- IncrementalReadDecoders.cs
- ValueUnavailableException.cs
- localization.cs
- DispatcherHookEventArgs.cs
- CollectionView.cs
- ConditionCollection.cs
- WebSysDisplayNameAttribute.cs
- CfgParser.cs
- LinkArea.cs
- SelectionPattern.cs
- Canvas.cs
- ScriptReferenceBase.cs
- MembershipSection.cs
- IsolatedStorageFile.cs
- StructuralType.cs
- SplashScreenNativeMethods.cs
- codemethodreferenceexpression.cs
- MethodCallTranslator.cs
- EventRoute.cs
- PrintEvent.cs
- TypedElement.cs
- WindowsRichEditRange.cs
- SequenceQuery.cs
- Evidence.cs
- DirectionalLight.cs
- StateItem.cs
- HScrollProperties.cs
- AbandonedMutexException.cs
- XMLUtil.cs
- _MultipleConnectAsync.cs
- SimplePropertyEntry.cs
- DependencyPropertyValueSerializer.cs
- OpenFileDialog.cs
- EnterpriseServicesHelper.cs
- ScrollBar.cs
- SafeRightsManagementQueryHandle.cs
- MemberCollection.cs
- OutArgument.cs
- Latin1Encoding.cs
- ObjectDataSourceMethodEventArgs.cs
- AutoGeneratedField.cs
- CacheMemory.cs
- VirtualizingStackPanel.cs
- XsdDateTime.cs
- SqlCommand.cs
- ToolstripProfessionalRenderer.cs
- PerformanceCounterNameAttribute.cs
- SecUtil.cs
- SystemIPv6InterfaceProperties.cs
- PropertyConverter.cs
- BitmapEffectGroup.cs
- PkcsMisc.cs
- SafeIUnknown.cs
- MapPathBasedVirtualPathProvider.cs
- TextDecorationUnitValidation.cs
- WebResourceAttribute.cs
- storepermissionattribute.cs
- DataGridViewTextBoxEditingControl.cs
- PhonemeConverter.cs
- StructuredType.cs
- KeyValuePairs.cs
- IntellisenseTextBox.designer.cs
- ImageClickEventArgs.cs
- SimpleLine.cs
- TransformPattern.cs
- MouseCaptureWithinProperty.cs
- HopperCache.cs
- DataServiceRequest.cs
- SQLByte.cs
- ToggleProviderWrapper.cs
- AddInStore.cs
- EventSetter.cs
- ObjectViewFactory.cs
- GotoExpression.cs