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
- SqlXmlStorage.cs
- ExceptionUtil.cs
- SafeHandle.cs
- PerformanceCounter.cs
- Vector3dCollection.cs
- DtdParser.cs
- CompilerTypeWithParams.cs
- SafeFileMappingHandle.cs
- UnionCqlBlock.cs
- XmlSchemaSimpleContentRestriction.cs
- OdbcDataAdapter.cs
- DirectoryInfo.cs
- TextSelectionHelper.cs
- FamilyMapCollection.cs
- ListParagraph.cs
- CodeDirectoryCompiler.cs
- RawStylusActions.cs
- DropShadowEffect.cs
- DefaultClaimSet.cs
- BitmapDecoder.cs
- ForAllOperator.cs
- ServiceNameCollection.cs
- NumberFunctions.cs
- SessionStateUtil.cs
- TemplateKeyConverter.cs
- storepermissionattribute.cs
- HealthMonitoringSectionHelper.cs
- SchemaImporterExtensionElementCollection.cs
- SvcMapFileSerializer.cs
- EndOfStreamException.cs
- StrokeFIndices.cs
- FormParameter.cs
- DrawingBrush.cs
- WebRequestModulesSection.cs
- unsafenativemethodstextservices.cs
- AsyncResult.cs
- InheritedPropertyChangedEventArgs.cs
- Content.cs
- COM2TypeInfoProcessor.cs
- WeakReferenceList.cs
- HMACRIPEMD160.cs
- PageBuildProvider.cs
- Base64Stream.cs
- EncodingDataItem.cs
- Int16Storage.cs
- DBCSCodePageEncoding.cs
- ToolStripSystemRenderer.cs
- EventToken.cs
- AuthenticationModuleElement.cs
- RijndaelManagedTransform.cs
- ObjectViewQueryResultData.cs
- DefaultEvaluationContext.cs
- IssuanceLicense.cs
- MissingMethodException.cs
- WebPartMinimizeVerb.cs
- SmtpNetworkElement.cs
- TracingConnection.cs
- mediaeventargs.cs
- TraceContextEventArgs.cs
- BatchStream.cs
- Compiler.cs
- TableLayoutRowStyleCollection.cs
- BamlLocalizabilityResolver.cs
- SchemaInfo.cs
- BStrWrapper.cs
- EmbeddedMailObjectsCollection.cs
- TypeInformation.cs
- Profiler.cs
- KeyBinding.cs
- FixedLineResult.cs
- BitmapFrame.cs
- RectAnimationClockResource.cs
- Schedule.cs
- SharedPersonalizationStateInfo.cs
- RadioButtonBaseAdapter.cs
- DbExpressionVisitor.cs
- PartialCachingAttribute.cs
- C14NUtil.cs
- KnownTypesHelper.cs
- ObjectListDataBindEventArgs.cs
- AutomationPeer.cs
- DataGridViewCellStyleConverter.cs
- ZipIOFileItemStream.cs
- DocumentGridPage.cs
- Effect.cs
- WmfPlaceableFileHeader.cs
- HttpDebugHandler.cs
- SQLByteStorage.cs
- ParseHttpDate.cs
- EtwTrace.cs
- XmlBinaryReaderSession.cs
- ObfuscateAssemblyAttribute.cs
- Accessible.cs
- ListViewAutomationPeer.cs
- Char.cs
- WCFBuildProvider.cs
- BinaryOperationBinder.cs
- DesignerAdapterUtil.cs
- TableStyle.cs
- HideDisabledControlAdapter.cs