Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / SkinIDTypeConverter.cs / 1 / SkinIDTypeConverter.cs
namespace System.Web.UI.Design { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Globalization; public class SkinIDTypeConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { return value; } return base.ConvertFrom(context, culture, value); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destType) { if (destType == typeof(string)) { return true; } return base.CanConvertTo(context, destType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (value is string) { return value; } return base.ConvertTo(context, culture, value, destinationType); } public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { if (context == null) return new StandardValuesCollection(new ArrayList()); Control control = (Control)context.Instance; ArrayList skins = new ArrayList(); if (control.Site != null) { IThemeResolutionService themeService = (IThemeResolutionService)control.Site.GetService(typeof(IThemeResolutionService)); ThemeProvider stylesheetThemeProvider = themeService.GetStylesheetThemeProvider(); ThemeProvider themeProvider = themeService.GetThemeProvider(); if (stylesheetThemeProvider != null) { skins.AddRange(stylesheetThemeProvider.GetSkinsForControl(control.GetType())); skins.Remove(String.Empty); } if (themeProvider != null) { ICollection themeSkins = themeProvider.GetSkinsForControl(control.GetType()); foreach (string skinID in themeSkins) { if (!skins.Contains(skinID)) { skins.Add(skinID); } } skins.Remove(String.Empty); } skins.Sort(); } return new StandardValuesCollection(skins); } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { ThemeProvider themeProvider = null; if (context != null) { Control control = (Control)context.Instance; if (control.Site != null) { IThemeResolutionService themeService = (IThemeResolutionService)control.Site.GetService(typeof(IThemeResolutionService)); if (themeService != null) { themeProvider = themeService.GetThemeProvider(); if (themeProvider == null) { themeProvider = themeService.GetStylesheetThemeProvider(); } } } } return (themeProvider != null); } } } // 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
- InstallerTypeAttribute.cs
- CharacterBuffer.cs
- CodeTypeParameterCollection.cs
- WebPartHeaderCloseVerb.cs
- InteropBitmapSource.cs
- ChangesetResponse.cs
- UrlEncodedParameterWriter.cs
- SoapHeaderAttribute.cs
- Serializer.cs
- EdmType.cs
- AuthorizationRule.cs
- MatrixConverter.cs
- DataList.cs
- WrappedIUnknown.cs
- DataGridViewRowsRemovedEventArgs.cs
- OracleRowUpdatingEventArgs.cs
- DecoderFallback.cs
- SimplePropertyEntry.cs
- MenuAutomationPeer.cs
- TypeConverterAttribute.cs
- Codec.cs
- MemoryMappedView.cs
- UnmanagedMemoryStream.cs
- ProvidersHelper.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- XamlFrame.cs
- XmlNodeReader.cs
- PrivacyNoticeBindingElement.cs
- HttpCachePolicyElement.cs
- CopyOnWriteList.cs
- GcSettings.cs
- WizardForm.cs
- AbstractSvcMapFileLoader.cs
- XPathAncestorIterator.cs
- OdbcTransaction.cs
- WebPartConnection.cs
- EntityDataSourceWizardForm.cs
- MeasurementDCInfo.cs
- PreviewControlDesigner.cs
- BindingListCollectionView.cs
- SmiEventSink_DeferedProcessing.cs
- StorageSetMapping.cs
- RequestCachingSection.cs
- ModelItemCollectionImpl.cs
- XmlWriterDelegator.cs
- SigningCredentials.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- SessionEndingEventArgs.cs
- StateManagedCollection.cs
- HMACSHA256.cs
- MonitorWrapper.cs
- RecordManager.cs
- FloatSumAggregationOperator.cs
- Variant.cs
- ISessionStateStore.cs
- OpCopier.cs
- XmlMembersMapping.cs
- NativeMethods.cs
- ScrollBarAutomationPeer.cs
- EdmSchemaAttribute.cs
- TcpClientCredentialType.cs
- SqlNodeAnnotations.cs
- OutputCacheSettingsSection.cs
- XsdDuration.cs
- BinaryParser.cs
- LayoutSettings.cs
- SimpleFieldTemplateFactory.cs
- PixelFormatConverter.cs
- X509UI.cs
- AssemblyInfo.cs
- DesignerVerbCollection.cs
- DashStyles.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- DataGridRowClipboardEventArgs.cs
- XPathDescendantIterator.cs
- TextStore.cs
- TreeNodeStyleCollection.cs
- RootBrowserWindowProxy.cs
- CodeAccessSecurityEngine.cs
- UIElement.cs
- WebPartZoneCollection.cs
- TableRow.cs
- StrongNameKeyPair.cs
- LogRestartAreaEnumerator.cs
- ByteStorage.cs
- StylusPointPropertyUnit.cs
- XmlNodeReader.cs
- MasterPageParser.cs
- ReceiveErrorHandling.cs
- XamlFrame.cs
- ExtendedProtectionPolicy.cs
- NavigationService.cs
- ListMarkerLine.cs
- ObsoleteAttribute.cs
- ResourceCategoryAttribute.cs
- ProviderUtil.cs
- CodeRegionDirective.cs
- HtmlInputReset.cs
- PersonalizablePropertyEntry.cs
- SSmlParser.cs