Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / ComponentResourceKeyConverter.cs / 1 / ComponentResourceKeyConverter.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Globalization;
using System.ComponentModel.Design.Serialization;
using System.Diagnostics;
namespace System.Windows.Markup
{
///
/// TypeConverter for a resource value expression
///
public class ComponentResourceKeyConverter : ExpressionConverter
{
///
/// TypeConverter method override.
///
///
/// ITypeDescriptorContext
///
///
/// Type to convert from
///
///
/// true if conversion is possible
///
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == null)
{
throw new ArgumentNullException("sourceType");
}
return base.CanConvertFrom(context, sourceType);
}
///
/// TypeConverter method override.
///
///
/// ITypeDescriptorContext
///
///
/// Type to convert to
///
///
/// true if conversion is possible
///
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
// Validate Input Arguments
if (destinationType == null)
{
throw new ArgumentNullException("destinationType");
}
return base.CanConvertTo(context, destinationType);
}
///
/// TypeConverter method implementation.
///
///
/// ITypeDescriptorContext
///
///
/// current culture (see CLR specs)
///
///
/// value to convert from
///
///
/// value that is result of conversion
///
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
return base.ConvertFrom(context, culture, value);
}
///
/// TypeConverter method implementation.
///
///
/// ITypeDescriptorContext
///
///
/// current culture (see CLR specs)
///
///
/// value to convert from
///
///
/// Type to convert to
///
///
/// converted value
///
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
// Validate Input Arguments
ComponentResourceKey key = value as ComponentResourceKey;
if (key == null)
{
throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "ComponentResourceKey"));
}
if (destinationType == null)
{
throw new ArgumentNullException("destinationType");
}
return base.CanConvertTo(context, destinationType);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Globalization;
using System.ComponentModel.Design.Serialization;
using System.Diagnostics;
namespace System.Windows.Markup
{
///
/// TypeConverter for a resource value expression
///
public class ComponentResourceKeyConverter : ExpressionConverter
{
///
/// TypeConverter method override.
///
///
/// ITypeDescriptorContext
///
///
/// Type to convert from
///
///
/// true if conversion is possible
///
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == null)
{
throw new ArgumentNullException("sourceType");
}
return base.CanConvertFrom(context, sourceType);
}
///
/// TypeConverter method override.
///
///
/// ITypeDescriptorContext
///
///
/// Type to convert to
///
///
/// true if conversion is possible
///
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
// Validate Input Arguments
if (destinationType == null)
{
throw new ArgumentNullException("destinationType");
}
return base.CanConvertTo(context, destinationType);
}
///
/// TypeConverter method implementation.
///
///
/// ITypeDescriptorContext
///
///
/// current culture (see CLR specs)
///
///
/// value to convert from
///
///
/// value that is result of conversion
///
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
return base.ConvertFrom(context, culture, value);
}
///
/// TypeConverter method implementation.
///
///
/// ITypeDescriptorContext
///
///
/// current culture (see CLR specs)
///
///
/// value to convert from
///
///
/// Type to convert to
///
///
/// converted value
///
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
// Validate Input Arguments
ComponentResourceKey key = value as ComponentResourceKey;
if (key == null)
{
throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "ComponentResourceKey"));
}
if (destinationType == null)
{
throw new ArgumentNullException("destinationType");
}
return base.CanConvertTo(context, 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
- Parser.cs
- WorkflowRuntimeSection.cs
- XPathNodePointer.cs
- SafeMILHandle.cs
- PenThreadPool.cs
- RNGCryptoServiceProvider.cs
- NavigationCommands.cs
- XmlSerializerSection.cs
- ExtensibleClassFactory.cs
- SystemColorTracker.cs
- TypeBuilderInstantiation.cs
- DrawingContextWalker.cs
- RegexCapture.cs
- UserControl.cs
- NumericUpDown.cs
- FakeModelItemImpl.cs
- HttpRequest.cs
- NameValuePermission.cs
- SQLStringStorage.cs
- BasicKeyConstraint.cs
- WorkflowQueue.cs
- ParamArrayAttribute.cs
- BinaryConverter.cs
- MessageBuffer.cs
- Section.cs
- sqlstateclientmanager.cs
- CodeAccessSecurityEngine.cs
- EventSourceCreationData.cs
- CommonProperties.cs
- EventData.cs
- FormViewUpdateEventArgs.cs
- _ConnectionGroup.cs
- XmlNodeReader.cs
- EdgeModeValidation.cs
- XsltLibrary.cs
- Message.cs
- HeaderedContentControl.cs
- ThicknessKeyFrameCollection.cs
- Input.cs
- DataAdapter.cs
- CommandField.cs
- TableHeaderCell.cs
- EventLogInternal.cs
- FutureFactory.cs
- HandlerBase.cs
- DesignerActionItemCollection.cs
- XPathNodeList.cs
- StateMachineSubscriptionManager.cs
- DispatcherHooks.cs
- DbMetaDataFactory.cs
- PackagingUtilities.cs
- AutomationIdentifierGuids.cs
- LostFocusEventManager.cs
- CacheManager.cs
- InitializerFacet.cs
- DataGridViewRowStateChangedEventArgs.cs
- UnsafeNetInfoNativeMethods.cs
- UnhandledExceptionEventArgs.cs
- SafeIUnknown.cs
- RangeBaseAutomationPeer.cs
- DSACryptoServiceProvider.cs
- PersonalizationStateInfo.cs
- sqlnorm.cs
- LayoutEvent.cs
- NestedContainer.cs
- LayoutSettings.cs
- SettingsPropertyCollection.cs
- SiteMapNode.cs
- AxHostDesigner.cs
- AppDomainInfo.cs
- ResourceWriter.cs
- IOException.cs
- DataTableMapping.cs
- ColorConvertedBitmap.cs
- MachineKeyConverter.cs
- DirectoryInfo.cs
- CompoundFileDeflateTransform.cs
- Rules.cs
- ModelItemCollectionImpl.cs
- BitVector32.cs
- DynamicResourceExtension.cs
- FileClassifier.cs
- WpfGeneratedKnownTypes.cs
- XmlSerializationWriter.cs
- ClassGenerator.cs
- XmlAutoDetectWriter.cs
- CodeDOMUtility.cs
- DockProviderWrapper.cs
- DataSourceCacheDurationConverter.cs
- ComNativeDescriptor.cs
- Menu.cs
- Internal.cs
- TypeSemantics.cs
- TemplateBindingExpression.cs
- SecurityHelper.cs
- PrintEvent.cs
- UnsafeNativeMethods.cs
- BaseTemplateBuildProvider.cs
- Rotation3DKeyFrameCollection.cs
- AnnotationAuthorChangedEventArgs.cs