Code:
/ FX-1434 / FX-1434 / 1.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
- RequestQueryProcessor.cs
- TiffBitmapDecoder.cs
- ToolStripRendererSwitcher.cs
- FieldDescriptor.cs
- ProviderConnectionPoint.cs
- rsa.cs
- CngAlgorithmGroup.cs
- ProjectionCamera.cs
- ActivityWithResultConverter.cs
- ReverseQueryOperator.cs
- EntitySetBaseCollection.cs
- ColumnResizeAdorner.cs
- PolyLineSegment.cs
- DataColumnPropertyDescriptor.cs
- StrokeDescriptor.cs
- Helper.cs
- ReadOnlyHierarchicalDataSource.cs
- XmlDocumentSchema.cs
- MemberAccessException.cs
- COM2ExtendedUITypeEditor.cs
- AdapterDictionary.cs
- MimeMultiPart.cs
- ImageFormat.cs
- GeneralTransform3DCollection.cs
- Error.cs
- DockingAttribute.cs
- ResourceAssociationSetEnd.cs
- CompositeActivityTypeDescriptorProvider.cs
- xmlglyphRunInfo.cs
- PrivateFontCollection.cs
- PageAsyncTask.cs
- VariableQuery.cs
- HostingPreferredMapPath.cs
- XPathConvert.cs
- PropertyEmitter.cs
- GetWinFXPath.cs
- PermissionSetEnumerator.cs
- IPCCacheManager.cs
- SspiSafeHandles.cs
- bindurihelper.cs
- CqlParser.cs
- WindowAutomationPeer.cs
- ContainerTracking.cs
- DockingAttribute.cs
- Size3D.cs
- ReceiveCompletedEventArgs.cs
- DiscoveryRequestHandler.cs
- DBConcurrencyException.cs
- CheckableControlBaseAdapter.cs
- TextRangeBase.cs
- TableCell.cs
- FontFaceLayoutInfo.cs
- StringHandle.cs
- ControllableStoryboardAction.cs
- AdornedElementPlaceholder.cs
- DataSourceHelper.cs
- xmlsaver.cs
- TraceHwndHost.cs
- SerialPinChanges.cs
- KeyBinding.cs
- HttpListenerException.cs
- DiscoveryVersionConverter.cs
- RuntimeUtils.cs
- EnumerableRowCollection.cs
- Tokenizer.cs
- FullTextBreakpoint.cs
- Binding.cs
- WebPageTraceListener.cs
- ProgressBar.cs
- Quaternion.cs
- CrossSiteScriptingValidation.cs
- NativeMethodsCLR.cs
- DataControlCommands.cs
- RemoteCryptoDecryptRequest.cs
- TypeBuilder.cs
- ProfilePropertyMetadata.cs
- TextElementCollection.cs
- UpdateCommand.cs
- WebPartMenu.cs
- VBIdentifierName.cs
- XmlCustomFormatter.cs
- BasicHttpMessageSecurityElement.cs
- HttpRequest.cs
- ZoneLinkButton.cs
- TextRunTypographyProperties.cs
- CodeTypeDeclaration.cs
- ReflectionTypeLoadException.cs
- CodeTypeOfExpression.cs
- PerfCounterSection.cs
- HttpWebRequestElement.cs
- CodeAccessPermission.cs
- CompressedStack.cs
- SmiEventSink_Default.cs
- EFColumnProvider.cs
- X509Utils.cs
- PointHitTestResult.cs
- ValidationRule.cs
- XmlSerializationWriter.cs
- WinFormsUtils.cs
- LocalizedNameDescriptionPair.cs