Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / System / Windows / Markup / TypeTypeConverter.cs / 1 / TypeTypeConverter.cs
/****************************************************************************\
*
* File: DateTimeConverter2.cs
*
\***************************************************************************/
using System;
using System.ComponentModel;
#if PBTCOMPILER
namespace MS.Internal.Markup
#else
namespace System.Windows.Markup
#endif
{
///
/// TypeConverter for System.Type
///
internal class TypeTypeConverter : TypeConverter
{
#if !PBTCOMPILER
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
string typeName = value as string;
if (null != context && typeName != null)
{
IXamlTypeResolver xamlTypeResolver = (IXamlTypeResolver)context.GetService(typeof(IXamlTypeResolver));
if (null != xamlTypeResolver)
{
return xamlTypeResolver.Resolve(typeName);
}
}
return base.ConvertFrom(context, culture, value);
}
#endif
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
/****************************************************************************\
*
* File: DateTimeConverter2.cs
*
\***************************************************************************/
using System;
using System.ComponentModel;
#if PBTCOMPILER
namespace MS.Internal.Markup
#else
namespace System.Windows.Markup
#endif
{
///
/// TypeConverter for System.Type
///
internal class TypeTypeConverter : TypeConverter
{
#if !PBTCOMPILER
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
string typeName = value as string;
if (null != context && typeName != null)
{
IXamlTypeResolver xamlTypeResolver = (IXamlTypeResolver)context.GetService(typeof(IXamlTypeResolver));
if (null != xamlTypeResolver)
{
return xamlTypeResolver.Resolve(typeName);
}
}
return base.ConvertFrom(context, culture, value);
}
#endif
}
}
// 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
- Compiler.cs
- StringResourceManager.cs
- TrueReadOnlyCollection.cs
- SerialReceived.cs
- PropertyPathWorker.cs
- CodeCompileUnit.cs
- Point4DConverter.cs
- DependentList.cs
- ToolStripDesignerUtils.cs
- WebPartMinimizeVerb.cs
- Material.cs
- TypeLoadException.cs
- XomlCompilerHelpers.cs
- ObjectItemLoadingSessionData.cs
- WebBrowsableAttribute.cs
- XamlToRtfParser.cs
- FontCacheLogic.cs
- TextChange.cs
- filewebrequest.cs
- EmbeddedMailObjectCollectionEditor.cs
- TrackingRecord.cs
- Module.cs
- RubberbandSelector.cs
- XmlReflectionImporter.cs
- FlowDecisionDesigner.xaml.cs
- DataGridColumnReorderingEventArgs.cs
- _BufferOffsetSize.cs
- SessionStateItemCollection.cs
- IpcChannelHelper.cs
- AutomationPropertyInfo.cs
- CompensatableTransactionScopeActivityDesigner.cs
- SettingsContext.cs
- WorkflowMessageEventArgs.cs
- WebConvert.cs
- PerformanceCounterPermissionEntry.cs
- StatusBarItemAutomationPeer.cs
- SqlTypesSchemaImporter.cs
- DocumentPageTextView.cs
- RelationshipManager.cs
- DesignerActionMethodItem.cs
- XslCompiledTransform.cs
- EntityContainerEmitter.cs
- Compiler.cs
- SchemaTypeEmitter.cs
- CodeSnippetTypeMember.cs
- DrawingBrush.cs
- TypeConverterHelper.cs
- HtmlHead.cs
- PagerSettings.cs
- TextSchema.cs
- SqlNotificationEventArgs.cs
- NodeInfo.cs
- ThicknessConverter.cs
- XmlValidatingReader.cs
- DataColumnChangeEvent.cs
- FocusTracker.cs
- XmlAnyAttributeAttribute.cs
- PathFigureCollectionValueSerializer.cs
- DBDataPermissionAttribute.cs
- Point3DAnimationBase.cs
- HttpServerVarsCollection.cs
- TransformerInfo.cs
- ViewgenContext.cs
- AssemblyCollection.cs
- ListSortDescription.cs
- ApplicationException.cs
- ContentPosition.cs
- UIntPtr.cs
- Cursors.cs
- CompilerScope.Storage.cs
- ProjectionPlan.cs
- PagesChangedEventArgs.cs
- SystemMulticastIPAddressInformation.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- EntityViewGenerationConstants.cs
- MouseOverProperty.cs
- PerformanceCounterPermissionEntry.cs
- Transform3D.cs
- MatrixAnimationUsingKeyFrames.cs
- ToolStripLocationCancelEventArgs.cs
- FragmentQueryKB.cs
- PaintEvent.cs
- DescriptionAttribute.cs
- ProviderConnectionPointCollection.cs
- CustomAttribute.cs
- GeometryModel3D.cs
- DCSafeHandle.cs
- cookieexception.cs
- IndentTextWriter.cs
- Command.cs
- WindowsFont.cs
- SettingsPropertyIsReadOnlyException.cs
- Mouse.cs
- Events.cs
- LongAverageAggregationOperator.cs
- XmlSchema.cs
- __Error.cs
- Border.cs
- SortKey.cs
- PrefixQName.cs