Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / DataGridTableStyleMappingNameEditor.cs / 1 / DataGridTableStyleMappingNameEditor.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.Design { using System.Design; using System; using System.ComponentModel; using System.ComponentModel.Design; using System.Drawing; using System.Drawing.Design; internal class DataGridTableStyleMappingNameEditor : UITypeEditor { // FxCop made me add this constructor private DataGridTableStyleMappingNameEditor() : base() {} private DesignBindingPicker designBindingPicker; public override bool IsDropDownResizable { get { return true; } } public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null && context.Instance != null) { object instance = context.Instance; DataGridTableStyle tableStyle = (DataGridTableStyle) context.Instance; if (tableStyle.DataGrid == null) return value; PropertyDescriptor dataSourceProperty = TypeDescriptor.GetProperties(tableStyle.DataGrid)["DataSource"]; if (dataSourceProperty != null) { object dataSource = dataSourceProperty.GetValue(tableStyle.DataGrid); if (designBindingPicker == null) { designBindingPicker = new DesignBindingPicker(); } DesignBinding oldSelection = new DesignBinding(dataSource, (string) value); DesignBinding newSelection = designBindingPicker.Pick(context, provider, false, /* showDataSources */ true, /* showDataMembers */ true, /* selectListMembers */ dataSource, String.Empty, oldSelection); if (dataSource != null && newSelection != null) { if (String.IsNullOrEmpty(newSelection.DataMember) || newSelection.DataMember == null) value = ""; else value = newSelection.DataField; } } } return value; } public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.DropDown; } } } // 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
- EventSourceCreationData.cs
- StyleModeStack.cs
- GPPOINT.cs
- MembershipSection.cs
- SignalGate.cs
- HttpProfileGroupBase.cs
- RecommendedAsConfigurableAttribute.cs
- DaylightTime.cs
- UrlPath.cs
- SafePEFileHandle.cs
- ToolStripItemClickedEventArgs.cs
- DataControlField.cs
- WeakHashtable.cs
- FilterRepeater.cs
- WorkflowMarkupElementEventArgs.cs
- IdentityHolder.cs
- ValidatedControlConverter.cs
- PathBox.cs
- SqlBulkCopyColumnMappingCollection.cs
- TextServicesContext.cs
- HtmlTableCell.cs
- Perspective.cs
- QuaternionAnimationBase.cs
- SqlInternalConnectionSmi.cs
- RecordsAffectedEventArgs.cs
- ConnectionProviderAttribute.cs
- Rotation3DAnimationUsingKeyFrames.cs
- XmlSchemaComplexType.cs
- SettingsPropertyValueCollection.cs
- KeyFrames.cs
- SafeEventLogWriteHandle.cs
- WindowsFormsSectionHandler.cs
- SqlDelegatedTransaction.cs
- DataGridAutoFormat.cs
- Rect3DConverter.cs
- FixedSOMLineRanges.cs
- Misc.cs
- ProxyManager.cs
- HMACSHA512.cs
- DataGridViewCellStyleConverter.cs
- ToolstripProfessionalRenderer.cs
- WebSysDescriptionAttribute.cs
- SettingsPropertyWrongTypeException.cs
- Property.cs
- ComplexPropertyEntry.cs
- Array.cs
- PrincipalPermission.cs
- SystemIcmpV6Statistics.cs
- ObjectNavigationPropertyMapping.cs
- TypeConstant.cs
- SourceFilter.cs
- DatatypeImplementation.cs
- PrintDialogDesigner.cs
- Pts.cs
- FontInfo.cs
- MaskedTextBoxTextEditorDropDown.cs
- HybridWebProxyFinder.cs
- PresentationSource.cs
- EventPrivateKey.cs
- PropertyTab.cs
- QueryableDataSourceEditData.cs
- IOThreadScheduler.cs
- ButtonStandardAdapter.cs
- RSACryptoServiceProvider.cs
- PriorityChain.cs
- DataPagerFieldItem.cs
- TimeManager.cs
- PngBitmapDecoder.cs
- GeneralTransformGroup.cs
- DefaultBinder.cs
- ExpressionPrinter.cs
- XmlText.cs
- XPathBinder.cs
- ExceptionValidationRule.cs
- SerialStream.cs
- ValueUtilsSmi.cs
- MemoryStream.cs
- ConfigsHelper.cs
- AddingNewEventArgs.cs
- CustomValidator.cs
- TriggerBase.cs
- StateMachineSubscription.cs
- SqlSelectStatement.cs
- AspCompat.cs
- TagNameToTypeMapper.cs
- DirectoryObjectSecurity.cs
- RestHandlerFactory.cs
- AnimationException.cs
- MembershipUser.cs
- KnowledgeBase.cs
- VisualStateChangedEventArgs.cs
- HierarchicalDataTemplate.cs
- HttpProtocolImporter.cs
- RightNameExpirationInfoPair.cs
- ConfigXmlElement.cs
- ButtonChrome.cs
- CatalogPart.cs
- CustomAttributeBuilder.cs
- OutputCacheProfile.cs
- SafeReadContext.cs