Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Markup / Baml2006 / TypeConverterMarkupExtension.cs / 1305600 / TypeConverterMarkupExtension.cs
using System; using System.Collections.Generic; using System.ComponentModel; namespace System.Windows.Baml2006 { internal class TypeConverterMarkupExtension : System.Windows.Markup.MarkupExtension { private TypeConverter _converter; private object _value; public TypeConverterMarkupExtension(TypeConverter converter, object value) { _converter = converter; _value = value; } public override object ProvideValue(IServiceProvider serviceProvider) { return _converter.ConvertFrom(new TypeConverterContext(serviceProvider), System.Globalization.CultureInfo.InvariantCulture, _value); } private class TypeConverterContext : ITypeDescriptorContext { private IServiceProvider _serviceProvider; public TypeConverterContext(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; } object IServiceProvider.GetService(Type serviceType) { return _serviceProvider.GetService(serviceType); } #region ITypeDescriptorContext Methods // ITypeDescriptorContext derives from IServiceProvider. void ITypeDescriptorContext.OnComponentChanged() { } bool ITypeDescriptorContext.OnComponentChanging() { return false; } IContainer ITypeDescriptorContext.Container { get { return null; } } object ITypeDescriptorContext.Instance { get { return null; } } PropertyDescriptor ITypeDescriptorContext.PropertyDescriptor { get { return null; } } #endregion } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections.Generic; using System.ComponentModel; namespace System.Windows.Baml2006 { internal class TypeConverterMarkupExtension : System.Windows.Markup.MarkupExtension { private TypeConverter _converter; private object _value; public TypeConverterMarkupExtension(TypeConverter converter, object value) { _converter = converter; _value = value; } public override object ProvideValue(IServiceProvider serviceProvider) { return _converter.ConvertFrom(new TypeConverterContext(serviceProvider), System.Globalization.CultureInfo.InvariantCulture, _value); } private class TypeConverterContext : ITypeDescriptorContext { private IServiceProvider _serviceProvider; public TypeConverterContext(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; } object IServiceProvider.GetService(Type serviceType) { return _serviceProvider.GetService(serviceType); } #region ITypeDescriptorContext Methods // ITypeDescriptorContext derives from IServiceProvider. void ITypeDescriptorContext.OnComponentChanged() { } bool ITypeDescriptorContext.OnComponentChanging() { return false; } IContainer ITypeDescriptorContext.Container { get { return null; } } object ITypeDescriptorContext.Instance { get { return null; } } PropertyDescriptor ITypeDescriptorContext.PropertyDescriptor { get { return null; } } #endregion } } } // 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
- SID.cs
- PageTheme.cs
- PropertyEmitterBase.cs
- TreeNodeEventArgs.cs
- DoubleIndependentAnimationStorage.cs
- BitmapFrame.cs
- SafeNativeMethods.cs
- NamespaceTable.cs
- SQLChars.cs
- SQLInt16.cs
- TableParagraph.cs
- HttpRawResponse.cs
- BatchStream.cs
- BoundPropertyEntry.cs
- DelegatedStream.cs
- InputMethodStateChangeEventArgs.cs
- Parser.cs
- ThreadInterruptedException.cs
- Geometry.cs
- CapabilitiesSection.cs
- GlyphShapingProperties.cs
- BuildManager.cs
- MLangCodePageEncoding.cs
- AuthenticationModuleElementCollection.cs
- SqlUtils.cs
- CannotUnloadAppDomainException.cs
- WebPartHelpVerb.cs
- translator.cs
- CodeObjectCreateExpression.cs
- FlowDocumentPaginator.cs
- ProtocolImporter.cs
- Figure.cs
- EntityDataSourceChangingEventArgs.cs
- EditorPartCollection.cs
- ButtonChrome.cs
- WaitHandle.cs
- DataSourceControlBuilder.cs
- assertwrapper.cs
- SqlServices.cs
- ZipIOExtraField.cs
- CommandValueSerializer.cs
- ObjectDataSourceEventArgs.cs
- OperandQuery.cs
- IODescriptionAttribute.cs
- DataRecordInfo.cs
- PathGeometry.cs
- MissingFieldException.cs
- ExceptionHandlers.cs
- UpdateInfo.cs
- DecimalAnimationUsingKeyFrames.cs
- ReflectionHelper.cs
- ReferenceSchema.cs
- MD5CryptoServiceProvider.cs
- CollectionsUtil.cs
- ChtmlSelectionListAdapter.cs
- WrappedIUnknown.cs
- GeneralTransform2DTo3DTo2D.cs
- WriteTimeStream.cs
- TypeDependencyAttribute.cs
- SqlConnectionHelper.cs
- CallbackDebugElement.cs
- WebBrowserContainer.cs
- ObjectStateFormatter.cs
- ColorContext.cs
- SmtpLoginAuthenticationModule.cs
- BoundColumn.cs
- DtdParser.cs
- ChangeProcessor.cs
- SoapMessage.cs
- TypeInitializationException.cs
- CommandValueSerializer.cs
- MasterPageParser.cs
- NativeWrapper.cs
- DBSchemaTable.cs
- SiteMapPathDesigner.cs
- UntypedNullExpression.cs
- OdbcError.cs
- DataGridViewRowStateChangedEventArgs.cs
- _CommandStream.cs
- X509Utils.cs
- TreeViewBindingsEditorForm.cs
- UriSectionData.cs
- TextCharacters.cs
- HelpInfo.cs
- DiscardableAttribute.cs
- SliderAutomationPeer.cs
- PropertyPathConverter.cs
- IIS7UserPrincipal.cs
- DataReaderContainer.cs
- ExtractorMetadata.cs
- OnOperation.cs
- HyperLinkField.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- PathSegment.cs
- CqlLexer.cs
- PlatformNotSupportedException.cs
- Convert.cs
- SafeRegistryHandle.cs
- ListBox.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs