Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebControls / DataBoundControlActionList.cs / 1 / DataBoundControlActionList.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.WebControls { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Design; using System.Diagnostics; using System.Web.UI.Design; using System.Web.UI.Design.Util; using System.Web.UI.WebControls; ///internal class DataBoundControlActionList : DesignerActionList { private IDataSourceDesigner _dataSourceDesigner; private ControlDesigner _controlDesigner; /// public DataBoundControlActionList(ControlDesigner controlDesigner, IDataSourceDesigner dataSourceDesigner) : base(controlDesigner.Component) { _controlDesigner = controlDesigner; _dataSourceDesigner = dataSourceDesigner; } public override bool AutoShow { get { return true; } set { } } /// [TypeConverterAttribute(typeof(DataSourceIDConverter))] public string DataSourceID { get { string dataSourceID = null; DataBoundControlDesigner dataBoundControlDesigner = _controlDesigner as DataBoundControlDesigner; if (dataBoundControlDesigner != null) { dataSourceID = dataBoundControlDesigner.DataSourceID; } else { BaseDataListDesigner bdlDesigner = _controlDesigner as BaseDataListDesigner; if (bdlDesigner != null) { dataSourceID = bdlDesigner.DataSourceID; } else { RepeaterDesigner repeaterDesigner = _controlDesigner as RepeaterDesigner; if (repeaterDesigner != null) { dataSourceID = repeaterDesigner.DataSourceID; } else { Debug.Fail("Unknown type called DataBoundControlActionList"); } } } if (String.IsNullOrEmpty(dataSourceID)) { return SR.GetString(SR.DataSourceIDChromeConverter_NoDataSource); } return dataSourceID; } set { ControlDesigner.InvokeTransactedChange(_controlDesigner.Component, new TransactedChangeCallback(SetDataSourceIDCallback), value, SR.GetString(SR.DataBoundControlActionList_SetDataSourceIDTransaction)); } } /// public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = new DesignerActionItemCollection(); PropertyDescriptor pd = TypeDescriptor.GetProperties(_controlDesigner.Component)["DataSourceID"]; if (pd != null && pd.IsBrowsable) { items.Add(new DesignerActionPropertyItem("DataSourceID", SR.GetString(SR.BaseDataBoundControl_ConfigureDataVerb), SR.GetString(SR.BaseDataBoundControl_DataActionGroup), SR.GetString(SR.BaseDataBoundControl_ConfigureDataVerbDesc))); } // add associated tasks ControlDesigner dsDesigner = _dataSourceDesigner as ControlDesigner; if (dsDesigner != null) { ((DesignerActionPropertyItem)items[0]).RelatedComponent = dsDesigner.Component; } return items; } private bool SetDataSourceIDCallback(object context) { string value = (string)context; DataBoundControlDesigner dataBoundControlDesigner = _controlDesigner as DataBoundControlDesigner; if (dataBoundControlDesigner != null) { PropertyDescriptor dataSourceIDDescriptor = TypeDescriptor.GetProperties(dataBoundControlDesigner.Component)["DataSourceID"]; dataSourceIDDescriptor.SetValue(dataBoundControlDesigner.Component, value); } else { BaseDataListDesigner bdlDesigner = _controlDesigner as BaseDataListDesigner; if (bdlDesigner != null) { PropertyDescriptor dataSourceIDDescriptor = TypeDescriptor.GetProperties(bdlDesigner.Component)["DataSourceID"]; dataSourceIDDescriptor.SetValue(bdlDesigner.Component, value); } else { RepeaterDesigner repeaterDesigner = _controlDesigner as RepeaterDesigner; if (repeaterDesigner != null) { PropertyDescriptor dataSourceIDDescriptor = TypeDescriptor.GetProperties(repeaterDesigner.Component)["DataSourceID"]; dataSourceIDDescriptor.SetValue(repeaterDesigner.Component, value); } else { Debug.Fail("Unknown type called DataBoundControlActionList"); } } } 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
- Vector3D.cs
- DesignerActionVerbItem.cs
- WebZone.cs
- ColumnMapCopier.cs
- MimeMultiPart.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- CompilationLock.cs
- MsmqChannelFactoryBase.cs
- NGCSerializationManagerAsync.cs
- MenuAdapter.cs
- CodeGotoStatement.cs
- RTLAwareMessageBox.cs
- ListManagerBindingsCollection.cs
- PointLightBase.cs
- NonSerializedAttribute.cs
- EventLogInformation.cs
- _AutoWebProxyScriptWrapper.cs
- StrokeCollection.cs
- QuaternionAnimation.cs
- X509IssuerSerialKeyIdentifierClause.cs
- PerspectiveCamera.cs
- CustomLineCap.cs
- SemanticResultValue.cs
- ProfileSettings.cs
- HtmlForm.cs
- ConstructorArgumentAttribute.cs
- ToolTipService.cs
- FileStream.cs
- tibetanshape.cs
- Highlights.cs
- SerialPinChanges.cs
- FileUpload.cs
- BamlLocalizationDictionary.cs
- DictionaryChange.cs
- PreloadHost.cs
- EmptyStringExpandableObjectConverter.cs
- CdpEqualityComparer.cs
- XmlSchemaInclude.cs
- ObjectParameter.cs
- DockAndAnchorLayout.cs
- TextAdaptor.cs
- StateWorkerRequest.cs
- SystemColors.cs
- ParameterBuilder.cs
- EventTrigger.cs
- InfoCardServiceInstallComponent.cs
- FileBasedResourceGroveler.cs
- CompareInfo.cs
- CheckBox.cs
- WebSysDefaultValueAttribute.cs
- OdbcConnectionHandle.cs
- SettingsBindableAttribute.cs
- MsmqProcessProtocolHandler.cs
- PassportAuthenticationEventArgs.cs
- FieldAccessException.cs
- PrimitiveCodeDomSerializer.cs
- ObjectViewFactory.cs
- DoneReceivingAsyncResult.cs
- CompoundFileStorageReference.cs
- TcpSocketManager.cs
- FormsAuthenticationModule.cs
- WebPartCancelEventArgs.cs
- RegexMatchCollection.cs
- CodeObjectCreateExpression.cs
- SiteMapSection.cs
- WindowsListViewSubItem.cs
- XPathArrayIterator.cs
- TypeInitializationException.cs
- DbProviderSpecificTypePropertyAttribute.cs
- StubHelpers.cs
- AppLevelCompilationSectionCache.cs
- TypeHelpers.cs
- LocalBuilder.cs
- ScopelessEnumAttribute.cs
- CollectionView.cs
- ValueConversionAttribute.cs
- RadioButtonPopupAdapter.cs
- ServicePointManagerElement.cs
- CryptoHandle.cs
- SqlConnectionFactory.cs
- ProjectedWrapper.cs
- ManagementObject.cs
- SerialPort.cs
- ComponentEvent.cs
- DispatcherTimer.cs
- CompressionTransform.cs
- ToolboxDataAttribute.cs
- MenuItem.cs
- CurrentChangingEventArgs.cs
- MenuItemAutomationPeer.cs
- DependencyObjectProvider.cs
- SimpleMailWebEventProvider.cs
- TdsParserSessionPool.cs
- AssemblyInfo.cs
- IteratorDescriptor.cs
- TreeViewTemplateSelector.cs
- BoolExpr.cs
- WebPartPersonalization.cs
- RSAOAEPKeyExchangeFormatter.cs
- DataGridViewSelectedCellCollection.cs