Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / DataBindingCollectionEditor.cs / 1 / DataBindingCollectionEditor.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.Design {
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using Control = System.Web.UI.Control;
///
///
///
/// Provides editing functions for data binding collections.
///
///
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]
[Obsolete("Use of this type is not recommended because DataBindings editing is launched via a DesignerActionList instead of the property grid. http://go.microsoft.com/fwlink/?linkid=14202")]
public class DataBindingCollectionEditor : UITypeEditor {
///
///
///
/// Edits a data binding within the design time
/// data binding collection.
///
///
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) {
Debug.Assert(context.Instance is Control, "Expected control");
Control c = (Control)context.Instance;
IServiceProvider site = c.Site;
if (site == null) {
if (c.Page != null) {
site = c.Page.Site;
}
if (site == null) {
site = provider;
}
}
if (site == null) {
//
return value;
}
IDesignerHost designerHost =
(IDesignerHost)site.GetService(typeof(IDesignerHost));
Debug.Assert(designerHost != null, "Must always have access to IDesignerHost service");
DesignerTransaction transaction = designerHost.CreateTransaction("(DataBindings)");
try {
IComponentChangeService changeService =
(IComponentChangeService)site.GetService(typeof(IComponentChangeService));
if (changeService != null) {
try {
changeService.OnComponentChanging(c, null);
}
catch (CheckoutException ce) {
if (ce == CheckoutException.Canceled)
return value;
throw ce;
}
}
DialogResult result = DialogResult.Cancel;
try {
DataBindingsDialog dbForm = new DataBindingsDialog(site, c);
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
result = edSvc.ShowDialog(dbForm);
}
finally {
if ((result == DialogResult.OK) && (changeService != null)) {
try {
changeService.OnComponentChanged(c, null, null, null);
}
catch {
}
}
}
}
finally {
transaction.Commit();
}
return value;
}
///
///
///
/// Gets the edit stytle for use by the editor.
///
///
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) {
return UITypeEditorEditStyle.Modal;
}
}
}
// 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
- SoapServerProtocol.cs
- FontDialog.cs
- DoubleLinkList.cs
- OutputCacheSettings.cs
- RtfNavigator.cs
- IssuerInformation.cs
- CancellationHandlerDesigner.cs
- QueryPageSettingsEventArgs.cs
- RuleInfoComparer.cs
- DataGridViewCellEventArgs.cs
- _ConnectionGroup.cs
- Location.cs
- SystemNetworkInterface.cs
- Int64AnimationBase.cs
- QilXmlWriter.cs
- GlobalProxySelection.cs
- ReflectEventDescriptor.cs
- EventProviderTraceListener.cs
- SystemIcmpV4Statistics.cs
- SingletonChannelAcceptor.cs
- PrimitiveXmlSerializers.cs
- ModuleBuilder.cs
- WSDualHttpSecurityMode.cs
- SqlParameterCollection.cs
- SynchronizationContext.cs
- Point3DKeyFrameCollection.cs
- TransactedReceiveScope.cs
- DefaultValueAttribute.cs
- ClassImporter.cs
- RulePatternOps.cs
- EntityDataSourceWrapper.cs
- ConnectionStringsSection.cs
- DataGridViewComboBoxColumn.cs
- RepeatBehaviorConverter.cs
- _FtpDataStream.cs
- MsdtcWrapper.cs
- XsdBuildProvider.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- RunInstallerAttribute.cs
- NameTable.cs
- TableProviderWrapper.cs
- PackageDigitalSignatureManager.cs
- TouchesCapturedWithinProperty.cs
- GridViewRowPresenter.cs
- TextFormatterHost.cs
- DataGridViewCellMouseEventArgs.cs
- ImageClickEventArgs.cs
- NumericExpr.cs
- OdbcRowUpdatingEvent.cs
- HGlobalSafeHandle.cs
- StringUtil.cs
- panel.cs
- Brushes.cs
- Parameter.cs
- EventRouteFactory.cs
- ActiveXSite.cs
- Stack.cs
- WmlImageAdapter.cs
- WorkflowTerminatedException.cs
- BuiltInExpr.cs
- RegexCompiler.cs
- TemplateField.cs
- ApplicationSecurityInfo.cs
- Translator.cs
- AuthenticationManager.cs
- Debug.cs
- DriveInfo.cs
- MatcherBuilder.cs
- MappingMetadataHelper.cs
- MethodToken.cs
- BufferedResponseStream.cs
- MatrixTransform3D.cs
- PageCatalogPart.cs
- XmlnsCompatibleWithAttribute.cs
- InlineUIContainer.cs
- CacheDependency.cs
- BitmapData.cs
- XpsFilter.cs
- thaishape.cs
- ScrollEvent.cs
- UnrecognizedPolicyAssertionElement.cs
- XmlAnyAttributeAttribute.cs
- OutputCacheProfile.cs
- AnnouncementInnerClientCD1.cs
- ReadingWritingEntityEventArgs.cs
- SemaphoreFullException.cs
- RoamingStoreFile.cs
- CultureMapper.cs
- EncryptedData.cs
- SimpleType.cs
- EmptyStringExpandableObjectConverter.cs
- ResourcesGenerator.cs
- MenuTracker.cs
- CustomGrammar.cs
- AvTraceDetails.cs
- PrintControllerWithStatusDialog.cs
- IncrementalReadDecoders.cs
- TimeZoneInfo.cs
- Token.cs
- PackageRelationshipSelector.cs