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
- XmlAttribute.cs
- NetworkInterface.cs
- WsiProfilesElementCollection.cs
- NumericPagerField.cs
- _KerberosClient.cs
- QueryGeneratorBase.cs
- OleDbStruct.cs
- ExpandedWrapper.cs
- thaishape.cs
- RemoteWebConfigurationHostStream.cs
- DesignerSerializationOptionsAttribute.cs
- IsolationInterop.cs
- DetailsViewCommandEventArgs.cs
- TagPrefixAttribute.cs
- AjaxFrameworkAssemblyAttribute.cs
- HiddenFieldPageStatePersister.cs
- JulianCalendar.cs
- Rect3D.cs
- XmlILAnnotation.cs
- PropertyMapper.cs
- CrossContextChannel.cs
- Guid.cs
- XXXInfos.cs
- RegexNode.cs
- AspCompat.cs
- WindowsPrincipal.cs
- XsltArgumentList.cs
- DBNull.cs
- CompModHelpers.cs
- GeneralTransform3DTo2DTo3D.cs
- DesignerLinkAdapter.cs
- CacheVirtualItemsEvent.cs
- TimeZone.cs
- FloaterParaClient.cs
- securitymgrsite.cs
- AssemblyFilter.cs
- XmlTextAttribute.cs
- DesignerSerializationOptionsAttribute.cs
- OracleConnectionString.cs
- BaseTemplateBuildProvider.cs
- ProfileServiceManager.cs
- System.Data_BID.cs
- CodeParameterDeclarationExpression.cs
- ProcessModule.cs
- PointUtil.cs
- XmlCountingReader.cs
- NameScopePropertyAttribute.cs
- HMACSHA512.cs
- SiteMapNodeItem.cs
- Options.cs
- DependencyPropertyValueSerializer.cs
- PostBackTrigger.cs
- TableRow.cs
- Faults.cs
- MultipartContentParser.cs
- LayoutUtils.cs
- _SingleItemRequestCache.cs
- FamilyCollection.cs
- UnsignedPublishLicense.cs
- JsonStringDataContract.cs
- InputScopeAttribute.cs
- TCEAdapterGenerator.cs
- ActivityExecutionFilter.cs
- RecognizeCompletedEventArgs.cs
- CellCreator.cs
- Line.cs
- tooltip.cs
- Number.cs
- ConfigXmlAttribute.cs
- Select.cs
- SqlGenericUtil.cs
- ModelItemImpl.cs
- SettingsProperty.cs
- unitconverter.cs
- CommandHelpers.cs
- ReadOnlyTernaryTree.cs
- AppDomainProtocolHandler.cs
- HandledMouseEvent.cs
- Formatter.cs
- ToolStripItemClickedEventArgs.cs
- CodeExpressionRuleDeclaration.cs
- entityreference_tresulttype.cs
- ReflectionTypeLoadException.cs
- MSAAEventDispatcher.cs
- TableLayoutRowStyleCollection.cs
- x509store.cs
- BezierSegment.cs
- CheckBox.cs
- SizeF.cs
- IApplicationTrustManager.cs
- RtfControls.cs
- ContainerParagraph.cs
- PageThemeParser.cs
- UIElement3D.cs
- KeyedHashAlgorithm.cs
- TextTrailingWordEllipsis.cs
- ColorTransformHelper.cs
- SharedHttpsTransportManager.cs
- WinEventTracker.cs
- ExpressionBindingCollection.cs