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
- ProfileSettingsCollection.cs
- BasicViewGenerator.cs
- Menu.cs
- XmlC14NWriter.cs
- RsaSecurityTokenAuthenticator.cs
- AbstractSvcMapFileLoader.cs
- ShaperBuffers.cs
- GeneralTransformGroup.cs
- UnsafeNativeMethods.cs
- ConnectionPointGlyph.cs
- CommandLineParser.cs
- NamedObject.cs
- ScrollChrome.cs
- ProfilePropertySettingsCollection.cs
- Math.cs
- OpCopier.cs
- HttpListenerPrefixCollection.cs
- StrokeNodeEnumerator.cs
- Imaging.cs
- CompiledXpathExpr.cs
- RangeValidator.cs
- RegexFCD.cs
- InputBuffer.cs
- RawStylusInputCustomDataList.cs
- Brush.cs
- IteratorFilter.cs
- BinaryMethodMessage.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- ProcessThreadCollection.cs
- DropDownList.cs
- CallContext.cs
- ShortcutKeysEditor.cs
- ListViewSortEventArgs.cs
- QuaternionConverter.cs
- sitestring.cs
- WebColorConverter.cs
- HiddenFieldPageStatePersister.cs
- EdmSchemaAttribute.cs
- AsyncPostBackTrigger.cs
- SmiConnection.cs
- HttpRequest.cs
- TreeViewItemAutomationPeer.cs
- DataException.cs
- FontWeights.cs
- IndexerReference.cs
- TimeSpanConverter.cs
- GeneratedContractType.cs
- ConfigurationErrorsException.cs
- Binding.cs
- MetadataSet.cs
- BatchParser.cs
- FixedLineResult.cs
- RootNamespaceAttribute.cs
- IdSpace.cs
- CodeCompiler.cs
- UnitySerializationHolder.cs
- NavigationPropertyEmitter.cs
- WhitespaceRule.cs
- AutoResetEvent.cs
- MenuCommandService.cs
- CompiledELinqQueryState.cs
- Component.cs
- Pkcs7Recipient.cs
- XmlnsDictionary.cs
- RoleManagerModule.cs
- CryptoStream.cs
- BuilderPropertyEntry.cs
- CaseInsensitiveHashCodeProvider.cs
- _AutoWebProxyScriptEngine.cs
- Lease.cs
- SqlDataRecord.cs
- InkCanvasSelectionAdorner.cs
- ThrowHelper.cs
- MethodImplAttribute.cs
- HtmlInputCheckBox.cs
- BitmapPalettes.cs
- AttributeEmitter.cs
- InstancePersistence.cs
- ExpressionBuilderContext.cs
- FontNamesConverter.cs
- _Win32.cs
- EntityConnection.cs
- DecoderFallback.cs
- FontCollection.cs
- DataGridItem.cs
- XslAstAnalyzer.cs
- HttpSessionStateWrapper.cs
- XmlEntity.cs
- LingerOption.cs
- CellParaClient.cs
- AnnotationAuthorChangedEventArgs.cs
- UInt64.cs
- IdentitySection.cs
- Rotation3D.cs
- WindowsIPAddress.cs
- OciHandle.cs
- GeometryModel3D.cs
- FindCriteriaApril2005.cs
- TextParagraphProperties.cs
- _ReceiveMessageOverlappedAsyncResult.cs