Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / System / Windows / Markup / TypeTypeConverter.cs / 1305600 / 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
- RSAOAEPKeyExchangeDeformatter.cs
- ConfigurationErrorsException.cs
- WsiProfilesElementCollection.cs
- EnumValAlphaComparer.cs
- DataKeyCollection.cs
- PropertySourceInfo.cs
- WindowsNonControl.cs
- StringValueSerializer.cs
- MobileControlBuilder.cs
- RSAOAEPKeyExchangeFormatter.cs
- ApplicationCommands.cs
- LicenseProviderAttribute.cs
- Int32EqualityComparer.cs
- MouseEvent.cs
- ConstructorExpr.cs
- DynamicILGenerator.cs
- ISCIIEncoding.cs
- StructureChangedEventArgs.cs
- X509SecurityTokenAuthenticator.cs
- ProvidePropertyAttribute.cs
- SessionEndingEventArgs.cs
- OutputChannelBinder.cs
- DataGridViewCellValidatingEventArgs.cs
- TextSchema.cs
- SchemaMerger.cs
- LocalizedNameDescriptionPair.cs
- PositiveTimeSpanValidatorAttribute.cs
- WebBrowsableAttribute.cs
- DbParameterCollection.cs
- ProcessHostMapPath.cs
- AudioFormatConverter.cs
- XmlQualifiedName.cs
- XsltLoader.cs
- LinkClickEvent.cs
- AlignmentYValidation.cs
- GeometryDrawing.cs
- ContextStack.cs
- ControlDesignerState.cs
- ApplicationManager.cs
- HttpCookieCollection.cs
- CssStyleCollection.cs
- VSDExceptions.cs
- MailMessageEventArgs.cs
- InsufficientMemoryException.cs
- FixedDocumentSequencePaginator.cs
- Image.cs
- XmlSequenceWriter.cs
- BuildManagerHost.cs
- CodeEntryPointMethod.cs
- WebPartDescription.cs
- DesignBindingEditor.cs
- SimpleLine.cs
- FileAuthorizationModule.cs
- Span.cs
- ExtensionFile.cs
- Annotation.cs
- ConfigurationPropertyAttribute.cs
- nulltextcontainer.cs
- XamlWrapperReaders.cs
- JoinGraph.cs
- SQLMembershipProvider.cs
- RegexCompiler.cs
- WindowHideOrCloseTracker.cs
- Point3DCollection.cs
- UserCancellationException.cs
- DataGridHelper.cs
- AsyncResult.cs
- XPathDocumentBuilder.cs
- Simplifier.cs
- SecuritySessionServerSettings.cs
- OutputCacheSettingsSection.cs
- FreezableDefaultValueFactory.cs
- XmlEventCache.cs
- XmlSerializableServices.cs
- SafeArrayTypeMismatchException.cs
- ElementUtil.cs
- SendSecurityHeaderElementContainer.cs
- InspectionWorker.cs
- SchemaExporter.cs
- EncoderParameters.cs
- ConnectionPointCookie.cs
- wmiprovider.cs
- ThreadStaticAttribute.cs
- HtmlPageAdapter.cs
- SizeAnimationBase.cs
- OleDbStruct.cs
- DispatcherExceptionEventArgs.cs
- DynamicMethod.cs
- UIElementIsland.cs
- DataServiceClientException.cs
- DispatcherTimer.cs
- RawContentTypeMapper.cs
- DecimalConverter.cs
- XmlTypeAttribute.cs
- SponsorHelper.cs
- XmlSerializableWriter.cs
- CodeAttributeArgument.cs
- BackStopAuthenticationModule.cs
- HiddenFieldPageStatePersister.cs
- InkCanvasAutomationPeer.cs