Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ControlBindingsConverter.cs / 1 / ControlBindingsConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.ControlBindingsConverter..ctor()")] namespace System.Windows.Forms.Design { using System; using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.Globalization; internal class ControlBindingsConverter : TypeConverter { public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { // return "(Bindings)"; // return an empty string, since we don't want a meaningless // string displayed as the value for the expandable Bindings property return ""; } return base.ConvertTo(context, culture, value, destinationType); } public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { if (value is ControlBindingsCollection) { ControlBindingsCollection collection = (ControlBindingsCollection)value; IBindableComponent control = collection.BindableComponent; Type type = control.GetType(); PropertyDescriptorCollection bindableProperties = TypeDescriptor.GetProperties(control, null); ArrayList props = new ArrayList(); for (int i = 0; i < bindableProperties.Count; i++) { // Create a read only binding if the data source is not one of the values we support. Binding binding = collection[bindableProperties[i].Name]; bool readOnly = !(binding == null || binding.DataSource is IListSource || binding.DataSource is IList || binding.DataSource is Array); DesignBindingPropertyDescriptor property = new DesignBindingPropertyDescriptor(bindableProperties[i], null, readOnly); bool bindable = ((BindableAttribute)bindableProperties[i].Attributes[typeof(BindableAttribute)]).Bindable; if (bindable || !((DesignBinding)property.GetValue(collection)).IsNull) { props.Add(property); } } props.Add(new AdvancedBindingPropertyDescriptor()); PropertyDescriptor[] propArray = new PropertyDescriptor[props.Count]; props.CopyTo(propArray,0); return new PropertyDescriptorCollection(propArray); } return new PropertyDescriptorCollection(new PropertyDescriptor[0]); } public override bool GetPropertiesSupported(ITypeDescriptorContext context) { return true; } } } // 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
- CodeTypeReferenceCollection.cs
- CqlParser.cs
- ThrowHelper.cs
- BitmapCacheBrush.cs
- MultipleViewPattern.cs
- CreateInstanceBinder.cs
- ZipIOExtraField.cs
- CategoryAttribute.cs
- SspiSecurityTokenProvider.cs
- ImageButton.cs
- OdbcConnectionFactory.cs
- InfoCardClaimCollection.cs
- DebugControllerThread.cs
- BrowserCapabilitiesFactory35.cs
- SqlConnectionFactory.cs
- AlphabetConverter.cs
- StorageMappingItemLoader.cs
- UmAlQuraCalendar.cs
- MenuCommand.cs
- RegistrationServices.cs
- TreeBuilderBamlTranslator.cs
- QueryCacheManager.cs
- GridView.cs
- RtfToXamlLexer.cs
- DataGridViewSortCompareEventArgs.cs
- Icon.cs
- AsyncContentLoadedEventArgs.cs
- AtlasWeb.Designer.cs
- SecurityTraceRecordHelper.cs
- StringResourceManager.cs
- HandlerWithFactory.cs
- RNGCryptoServiceProvider.cs
- CompiledAction.cs
- DefaultValueConverter.cs
- SendKeys.cs
- _Win32.cs
- KnownColorTable.cs
- ObjectCacheHost.cs
- LabelAutomationPeer.cs
- TextCompositionEventArgs.cs
- UriTemplatePathPartiallyEquivalentSet.cs
- BuildResult.cs
- WindowsListViewSubItem.cs
- Condition.cs
- Publisher.cs
- PKCS1MaskGenerationMethod.cs
- RightNameExpirationInfoPair.cs
- EmptyEnumerator.cs
- WebServiceBindingAttribute.cs
- ThicknessKeyFrameCollection.cs
- HandlerFactoryWrapper.cs
- PositiveTimeSpanValidator.cs
- StringBuilder.cs
- SamlSubject.cs
- ProfessionalColors.cs
- WebPartPersonalization.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ZoneMembershipCondition.cs
- DataPagerField.cs
- UseLicense.cs
- DrawListViewColumnHeaderEventArgs.cs
- MetafileHeader.cs
- ConnectionManager.cs
- CursorEditor.cs
- ReferentialConstraint.cs
- CurrentChangingEventArgs.cs
- CookieParameter.cs
- PhysicalOps.cs
- TableLayoutSettings.cs
- smtppermission.cs
- SizeChangedEventArgs.cs
- MultiSelectRootGridEntry.cs
- PostBackTrigger.cs
- StateDesignerConnector.cs
- CustomAttribute.cs
- GregorianCalendarHelper.cs
- XPathNavigatorKeyComparer.cs
- TextFormatterContext.cs
- CSharpCodeProvider.cs
- EnlistmentTraceIdentifier.cs
- DatagridviewDisplayedBandsData.cs
- XmlLoader.cs
- MultipleViewProviderWrapper.cs
- StoreItemCollection.Loader.cs
- PointAnimationClockResource.cs
- ThreadInterruptedException.cs
- ConfigurationManagerInternalFactory.cs
- FloaterBaseParaClient.cs
- PagesSection.cs
- KeyboardDevice.cs
- SqlParameterCollection.cs
- InvalidOleVariantTypeException.cs
- Rfc2898DeriveBytes.cs
- Win32Native.cs
- ConstraintStruct.cs
- VirtualPathUtility.cs
- EntryPointNotFoundException.cs
- ProtocolsConfigurationEntry.cs
- ZoneLinkButton.cs
- DurableInstance.cs