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 / 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
- FixedPageStructure.cs
- GridViewActionList.cs
- ReflectionUtil.cs
- ExtendedPropertyInfo.cs
- InstanceDataCollection.cs
- DummyDataSource.cs
- FilterableAttribute.cs
- TextBoxBase.cs
- ISessionStateStore.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- Rijndael.cs
- UInt64Storage.cs
- AttributeCollection.cs
- ContextStaticAttribute.cs
- ApplicationInfo.cs
- IPCCacheManager.cs
- TextProviderWrapper.cs
- StreamInfo.cs
- SQLMoney.cs
- InputElement.cs
- ActiveXSerializer.cs
- OutputScope.cs
- ChameleonKey.cs
- PeerNameRecordCollection.cs
- CqlWriter.cs
- safePerfProviderHandle.cs
- BitmapSource.cs
- FixedSOMElement.cs
- XmlSerializableServices.cs
- SmiConnection.cs
- ObsoleteAttribute.cs
- SettingsPropertyValue.cs
- DbDeleteCommandTree.cs
- DataSet.cs
- Column.cs
- RunWorkerCompletedEventArgs.cs
- TemplateBindingExpressionConverter.cs
- RootBuilder.cs
- CurrentChangingEventManager.cs
- StringUtil.cs
- WebServiceFault.cs
- TypeKeyValue.cs
- MimeMapping.cs
- AuthenticationConfig.cs
- ContextMenuAutomationPeer.cs
- SizeF.cs
- StreamWriter.cs
- ConditionCollection.cs
- ResXFileRef.cs
- HtmlContainerControl.cs
- App.cs
- AnnotationComponentChooser.cs
- SqlDataSourceCommandEventArgs.cs
- PassportIdentity.cs
- COM2PropertyDescriptor.cs
- HwndKeyboardInputProvider.cs
- AtomServiceDocumentSerializer.cs
- ObjRef.cs
- FrameworkElementAutomationPeer.cs
- XmlSchemaObject.cs
- HtmlInputSubmit.cs
- OrderingInfo.cs
- HttpCapabilitiesEvaluator.cs
- IndexingContentUnit.cs
- ClientSettings.cs
- SelectedGridItemChangedEvent.cs
- DBSchemaTable.cs
- securitymgrsite.cs
- EdmType.cs
- CategoryList.cs
- FormViewCommandEventArgs.cs
- BackStopAuthenticationModule.cs
- WeakReference.cs
- EncryptedHeaderXml.cs
- DynamicDiscoSearcher.cs
- XdrBuilder.cs
- ResourcePermissionBaseEntry.cs
- OutputCacheProfile.cs
- ObjectConverter.cs
- CommandDesigner.cs
- Metafile.cs
- ConfigurationStrings.cs
- InputBuffer.cs
- PersistenceTask.cs
- EventQueueState.cs
- TimeIntervalCollection.cs
- FlowLayoutSettings.cs
- Stacktrace.cs
- HWStack.cs
- FileClassifier.cs
- PtsPage.cs
- EarlyBoundInfo.cs
- MobileUITypeEditor.cs
- ClosableStream.cs
- FormatException.cs
- PrintDocument.cs
- NameObjectCollectionBase.cs
- METAHEADER.cs
- DockAndAnchorLayout.cs
- CryptoApi.cs