Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / DataGridColumnStyleMappingNameEditor.cs / 1 / DataGridColumnStyleMappingNameEditor.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 DataGridColumnStyleMappingNameEditor : UITypeEditor { // FxCop made me add this constructor private DataGridColumnStyleMappingNameEditor() : 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; DataGridColumnStyle columnStyle = (DataGridColumnStyle) context.Instance; if (columnStyle.DataGridTableStyle == null || columnStyle.DataGridTableStyle.DataGrid == null) return value; PropertyDescriptor dataSourceProperty = TypeDescriptor.GetProperties(columnStyle.DataGridTableStyle.DataGrid)["DataSource"]; if (dataSourceProperty != null) { object dataSource = dataSourceProperty.GetValue(columnStyle.DataGridTableStyle.DataGrid); if (designBindingPicker == null) { designBindingPicker = new DesignBindingPicker(); } DesignBinding oldSelection = new DesignBinding(null, (string) value); DesignBinding newSelection = designBindingPicker.Pick(context, provider, false, /* showDataSources */ true, /* showDataMembers */ false, /* 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
- Root.cs
- ContractMapping.cs
- WindowsComboBox.cs
- ImageConverter.cs
- TypeReference.cs
- WebPartAddingEventArgs.cs
- ScriptDescriptor.cs
- RichTextBoxAutomationPeer.cs
- TextEndOfLine.cs
- ImageAnimator.cs
- ChameleonKey.cs
- ConstNode.cs
- FileLogRecordEnumerator.cs
- ClientRuntimeConfig.cs
- XdrBuilder.cs
- PerformanceCounterCategory.cs
- DependentList.cs
- DataRow.cs
- NodeInfo.cs
- SoapMessage.cs
- InfoCardBaseException.cs
- DbCommandDefinition.cs
- OrderedDictionaryStateHelper.cs
- UndoUnit.cs
- XPathAncestorQuery.cs
- HttpStreamMessage.cs
- ExpressionContext.cs
- DeflateStreamAsyncResult.cs
- PersonalizationEntry.cs
- CollectionViewProxy.cs
- HtmlInputCheckBox.cs
- UpdateDelegates.Generated.cs
- AlphaSortedEnumConverter.cs
- TemplateColumn.cs
- RawTextInputReport.cs
- ListViewDeleteEventArgs.cs
- KeyFrames.cs
- HandlerBase.cs
- SafeFileMappingHandle.cs
- ComboBox.cs
- DesignTimeParseData.cs
- JsonDeserializer.cs
- PermissionToken.cs
- FormatterConverter.cs
- CommentEmitter.cs
- VerificationAttribute.cs
- Pool.cs
- StylusShape.cs
- StringAttributeCollection.cs
- Stopwatch.cs
- XpsSerializationManager.cs
- IDispatchConstantAttribute.cs
- ToolboxItemCollection.cs
- JsonWriter.cs
- XmlNotation.cs
- ScriptingJsonSerializationSection.cs
- Inline.cs
- MimeWriter.cs
- XslUrlEditor.cs
- OneToOneMappingSerializer.cs
- DockingAttribute.cs
- ImageInfo.cs
- Lasso.cs
- Monitor.cs
- DataGridViewCellEventArgs.cs
- Hashtable.cs
- MULTI_QI.cs
- DataGridColumnStyleMappingNameEditor.cs
- invalidudtexception.cs
- RegexFCD.cs
- SocketCache.cs
- DataControlButton.cs
- KnownTypeAttribute.cs
- InProcStateClientManager.cs
- TCPListener.cs
- FormViewPagerRow.cs
- IsolatedStoragePermission.cs
- DecimalConverter.cs
- RecognizeCompletedEventArgs.cs
- CompilationSection.cs
- SystemIcmpV4Statistics.cs
- ToolStripGripRenderEventArgs.cs
- ContractNamespaceAttribute.cs
- DocumentApplication.cs
- WithParamAction.cs
- Utils.cs
- ContextStaticAttribute.cs
- SpellerStatusTable.cs
- NaturalLanguageHyphenator.cs
- DPAPIProtectedConfigurationProvider.cs
- GreenMethods.cs
- StateValidator.cs
- rsa.cs
- TextBoxRenderer.cs
- FakeModelPropertyImpl.cs
- AutoScrollExpandMessageFilter.cs
- SpecularMaterial.cs
- CSharpCodeProvider.cs
- BatchStream.cs
- InvokeBase.cs