Code:
/ DotNET / DotNET / 8.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
- HttpListener.cs
- MenuItem.cs
- IgnoreSectionHandler.cs
- Rotation3DAnimationUsingKeyFrames.cs
- DistinctQueryOperator.cs
- PropertyRef.cs
- NativeCompoundFileAPIs.cs
- Psha1DerivedKeyGenerator.cs
- Attributes.cs
- EntitySetBase.cs
- Utils.cs
- ObjectQueryProvider.cs
- DataViewSettingCollection.cs
- SmtpSection.cs
- ApplicationId.cs
- StringPropertyBuilder.cs
- ExpressionBinding.cs
- StructuralCache.cs
- PolyBezierSegment.cs
- _CacheStreams.cs
- PropertyReference.cs
- VectorCollectionConverter.cs
- MatrixKeyFrameCollection.cs
- SecurityIdentifierElement.cs
- TransformGroup.cs
- RangeValuePattern.cs
- DataSourceProvider.cs
- ClientData.cs
- RegexRunner.cs
- BaseTreeIterator.cs
- TcpStreams.cs
- DataBoundControlHelper.cs
- ApplicationTrust.cs
- InputScopeManager.cs
- UITypeEditor.cs
- LiteralControl.cs
- CodeBlockBuilder.cs
- PasswordBoxAutomationPeer.cs
- XmlSerializerAssemblyAttribute.cs
- CheckBoxAutomationPeer.cs
- DtrList.cs
- MsmqActivation.cs
- GridSplitter.cs
- DocumentGridPage.cs
- FileController.cs
- InteropAutomationProvider.cs
- FilterElement.cs
- StructuralType.cs
- IdentityNotMappedException.cs
- ChildChangedEventArgs.cs
- CellTreeNode.cs
- PreviewPageInfo.cs
- EmbeddedObject.cs
- AccessKeyManager.cs
- EventTask.cs
- DateTimeOffsetConverter.cs
- ContentPathSegment.cs
- FunctionNode.cs
- AuthorizationSection.cs
- ToolstripProfessionalRenderer.cs
- DesignerVerbToolStripMenuItem.cs
- SynchronizingStream.cs
- FilterableAttribute.cs
- WmlCommandAdapter.cs
- CellConstant.cs
- FilterElement.cs
- CryptoConfig.cs
- ThreadPool.cs
- DataGridColumn.cs
- PeerNameRecordCollection.cs
- DbSource.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- AuthorizationSection.cs
- TextBox.cs
- OleDbStruct.cs
- SkewTransform.cs
- ISAPIWorkerRequest.cs
- IisTraceWebEventProvider.cs
- PrimitiveType.cs
- BamlBinaryReader.cs
- KeyValuePairs.cs
- DataSysAttribute.cs
- GrammarBuilderBase.cs
- BindingExpressionUncommonField.cs
- CounterSetInstanceCounterDataSet.cs
- Bold.cs
- ReaderWriterLockWrapper.cs
- WmlListAdapter.cs
- ResourceSet.cs
- HwndHost.cs
- _ConnectOverlappedAsyncResult.cs
- TargetConverter.cs
- IResourceProvider.cs
- ColorInterpolationModeValidation.cs
- SocketStream.cs
- BrowserDefinition.cs
- WmlCommandAdapter.cs
- SoapTypeAttribute.cs
- SiteIdentityPermission.cs
- TextEditorMouse.cs