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
- PropertyBuilder.cs
- SafeNativeMethodsMilCoreApi.cs
- CustomTypeDescriptor.cs
- InlineObject.cs
- DataGridViewRowEventArgs.cs
- PinnedBufferMemoryStream.cs
- LinkedList.cs
- ModelTreeEnumerator.cs
- BuilderElements.cs
- QuerySafeNavigator.cs
- DbConnectionPool.cs
- EntityCommandExecutionException.cs
- ReplyAdapterChannelListener.cs
- LockCookie.cs
- NumberEdit.cs
- TypeDefinition.cs
- SQLGuidStorage.cs
- XmlParserContext.cs
- IPGlobalProperties.cs
- cookie.cs
- DbConnectionClosed.cs
- BaseProcessor.cs
- LinkDesigner.cs
- DataException.cs
- FrameworkElementFactoryMarkupObject.cs
- MediaElementAutomationPeer.cs
- Pen.cs
- DecoderBestFitFallback.cs
- BinaryUtilClasses.cs
- DesignerCommandSet.cs
- GroupStyle.cs
- MachineKey.cs
- AstTree.cs
- ToolStripDropDownMenu.cs
- CustomLineCap.cs
- TextParagraphView.cs
- ResourceReferenceExpressionConverter.cs
- FormatStringEditor.cs
- ConfigurationStrings.cs
- CodeBlockBuilder.cs
- CommonRemoteMemoryBlock.cs
- SafeMILHandle.cs
- RepeatEnumerable.cs
- MatrixTransform.cs
- AutomationPropertyInfo.cs
- PersonalizationProvider.cs
- EtwTrace.cs
- PersonalizationStateInfo.cs
- HotSpotCollectionEditor.cs
- ExpressionBuilderContext.cs
- DataGridViewComboBoxColumn.cs
- NamedPipeConnectionPoolSettingsElement.cs
- StringKeyFrameCollection.cs
- BevelBitmapEffect.cs
- XmlHierarchyData.cs
- DetailsViewCommandEventArgs.cs
- SessionEndedEventArgs.cs
- ComEventsHelper.cs
- BufferBuilder.cs
- HttpModulesSection.cs
- Rijndael.cs
- ManagedCodeMarkers.cs
- TrackBar.cs
- StrongNameKeyPair.cs
- SimpleExpression.cs
- TagMapInfo.cs
- SchemaMerger.cs
- EmptyImpersonationContext.cs
- PropertyGroupDescription.cs
- WebPartConnectionCollection.cs
- ContainerUtilities.cs
- FieldBuilder.cs
- SortDescription.cs
- SystemResourceKey.cs
- QilPatternVisitor.cs
- UriExt.cs
- pingexception.cs
- WebPartTransformer.cs
- HtmlInputHidden.cs
- DataGridItem.cs
- PenLineJoinValidation.cs
- XmlElement.cs
- TransformerInfo.cs
- TextBoxBase.cs
- XmlLanguage.cs
- MediaCommands.cs
- ContentValidator.cs
- OleDbEnumerator.cs
- ErrorRuntimeConfig.cs
- ProfilePropertyNameValidator.cs
- RequiredFieldValidator.cs
- OdbcReferenceCollection.cs
- SubMenuStyle.cs
- RenderingEventArgs.cs
- XmlTextReaderImpl.cs
- FunctionQuery.cs
- Int32.cs
- ViewEventArgs.cs
- CodeObjectCreateExpression.cs
- BufferedReadStream.cs