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
- CanonicalFormWriter.cs
- Effect.cs
- DependencyObject.cs
- Constant.cs
- StructuralCache.cs
- ErrorHandler.cs
- BoundColumn.cs
- _HelperAsyncResults.cs
- TreeNodeCollection.cs
- RadioButton.cs
- XmlWrappingWriter.cs
- SQLCharsStorage.cs
- ReturnValue.cs
- Base64Decoder.cs
- InsufficientExecutionStackException.cs
- DataSysAttribute.cs
- SqlConnectionStringBuilder.cs
- ComboBoxItem.cs
- SelectionBorderGlyph.cs
- AdornerPresentationContext.cs
- MetadataProperty.cs
- ConnectionManagementElement.cs
- ObjectCacheHost.cs
- XmlSchemaGroup.cs
- WpfKnownType.cs
- StrongNameUtility.cs
- ChangePasswordAutoFormat.cs
- AsyncOperationManager.cs
- DetailsViewPageEventArgs.cs
- MimeWriter.cs
- InternalReceiveMessage.cs
- SqlNotificationRequest.cs
- ProcessHostConfigUtils.cs
- TextRangeEditLists.cs
- LoginDesigner.cs
- RenderTargetBitmap.cs
- AliasExpr.cs
- XmlSchemaChoice.cs
- DataSetMappper.cs
- AttributeUsageAttribute.cs
- MsmqChannelFactoryBase.cs
- SqlCommandAsyncResult.cs
- ByeMessageApril2005.cs
- AdornerPresentationContext.cs
- PackWebRequest.cs
- ScrollChrome.cs
- EmptyWithCancelationCheckWorkItem.cs
- HtmlElementCollection.cs
- CheckBoxPopupAdapter.cs
- PrintingPermission.cs
- BufferedStream.cs
- ManualResetEvent.cs
- ButtonColumn.cs
- PageEventArgs.cs
- SpnEndpointIdentity.cs
- ManagedWndProcTracker.cs
- IIS7UserPrincipal.cs
- SystemIPGlobalStatistics.cs
- StrongBox.cs
- SkinBuilder.cs
- RawStylusActions.cs
- DoubleUtil.cs
- ListViewGroupConverter.cs
- SizeConverter.cs
- ExpressionBuilder.cs
- MgmtConfigurationRecord.cs
- DateTimePickerDesigner.cs
- ToolboxItemFilterAttribute.cs
- X509DefaultServiceCertificateElement.cs
- FreezableDefaultValueFactory.cs
- FieldNameLookup.cs
- MutableAssemblyCacheEntry.cs
- PagesChangedEventArgs.cs
- Application.cs
- AutomationPeer.cs
- TypeNameParser.cs
- updateconfighost.cs
- SettingsAttributeDictionary.cs
- StrongNameUtility.cs
- Emitter.cs
- ParallelTimeline.cs
- Image.cs
- Positioning.cs
- BindingContext.cs
- NamedPipeAppDomainProtocolHandler.cs
- RecordsAffectedEventArgs.cs
- TemplateControlCodeDomTreeGenerator.cs
- CultureInfo.cs
- Dispatcher.cs
- DockPanel.cs
- ArrayItemReference.cs
- MD5Cng.cs
- BCLDebug.cs
- XamlHostingConfiguration.cs
- LocalizedNameDescriptionPair.cs
- CssStyleCollection.cs
- NotImplementedException.cs
- IISUnsafeMethods.cs
- SimpleBitVector32.cs
- StateBag.cs