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
- FirstQueryOperator.cs
- SqlAliasesReferenced.cs
- FtpWebRequest.cs
- FilteredAttributeCollection.cs
- TextParaLineResult.cs
- ScriptRef.cs
- OpenTypeLayout.cs
- TextBoxRenderer.cs
- SiteMapNode.cs
- DeflateEmulationStream.cs
- TextDecoration.cs
- UIElement3D.cs
- AmbientProperties.cs
- Subset.cs
- PreApplicationStartMethodAttribute.cs
- EntityDataSourceWizardForm.cs
- Module.cs
- TrackBarRenderer.cs
- LineProperties.cs
- OpenTypeCommon.cs
- ConsoleKeyInfo.cs
- Composition.cs
- PropertyItemInternal.cs
- NumericUpDownAccelerationCollection.cs
- XmlFormatExtensionPrefixAttribute.cs
- WindowsButton.cs
- ParameterReplacerVisitor.cs
- Rfc2898DeriveBytes.cs
- MultitargetUtil.cs
- ImageButton.cs
- ApplicationTrust.cs
- StateMachineSubscriptionManager.cs
- AdornerDecorator.cs
- ByteStorage.cs
- PagerSettings.cs
- PrintDialogException.cs
- WebPartDisplayMode.cs
- AppDomainUnloadedException.cs
- _Connection.cs
- NavigationWindow.cs
- ComProxy.cs
- FlowDocumentView.cs
- FilteredSchemaElementLookUpTable.cs
- XmlSiteMapProvider.cs
- GenericXmlSecurityToken.cs
- PixelFormat.cs
- IndentTextWriter.cs
- ConnectionManagementSection.cs
- BreakRecordTable.cs
- ColorConvertedBitmap.cs
- ThaiBuddhistCalendar.cs
- RotateTransform.cs
- Converter.cs
- DataGridViewEditingControlShowingEventArgs.cs
- StateMachineSubscriptionManager.cs
- BitmapCodecInfoInternal.cs
- Blend.cs
- MouseGestureConverter.cs
- XPathDocumentBuilder.cs
- PieceDirectory.cs
- SessionIDManager.cs
- GenericEnumConverter.cs
- SystemNetHelpers.cs
- Transform3D.cs
- MetroSerializationManager.cs
- XmlAnyElementAttribute.cs
- MobileContainerDesigner.cs
- ColorMatrix.cs
- WinCategoryAttribute.cs
- Rule.cs
- SHA256Managed.cs
- MessageBox.cs
- ExtenderProviderService.cs
- XhtmlBasicLinkAdapter.cs
- StateBag.cs
- SpAudioStreamWrapper.cs
- TlsSspiNegotiation.cs
- StateDesigner.Layouts.cs
- DataGridViewCellPaintingEventArgs.cs
- Command.cs
- safesecurityhelperavalon.cs
- ChannelBinding.cs
- VisualTarget.cs
- BypassElement.cs
- ArraySubsetEnumerator.cs
- XmlIlGenerator.cs
- URLBuilder.cs
- MiniCustomAttributeInfo.cs
- EllipseGeometry.cs
- DependencyPropertyAttribute.cs
- DataObjectCopyingEventArgs.cs
- D3DImage.cs
- SubclassTypeValidator.cs
- PartialList.cs
- SqlDataSourceView.cs
- SymbolType.cs
- PerformanceCounterPermissionEntryCollection.cs
- ExecutionContext.cs
- DependencyProperty.cs
- EncoderParameters.cs