Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebControls / DataFieldEditor.cs / 1 / DataFieldEditor.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.Web.UI.Design.WebControls {
using System;
using System.Collections;
using Microsoft.Win32;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
///
///
/// The DataFieldEditor is a collection editor that is specifically
/// designed to edit arrays containing strings.
///
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]
internal class DataFieldEditor : DataFieldCollectionEditor {
public DataFieldEditor(Type type) : base(type) {
}
///
///
/// Retrieves the data type this collection contains. The default
/// implementation looks inside of the collection for the Item property
/// and returns the returning datatype of the item. Do not call this
/// method directly. Instead, use the CollectionItemType property. Use this
/// method to override the default implementation.
///
protected override Type CreateCollectionItemType() {
return CollectionType.GetElementType();
}
///
///
/// We implement the getting and setting of items on this collection.
///
protected override object[] GetItems(object editValue) {
if (editValue is Array) {
Array valueArray = (Array)editValue;
object[] items = new object[valueArray.GetLength(0)];
Array.Copy(valueArray, items, items.Length);
return items;
}
else {
return new object[0];
}
}
///
///
/// We implement the getting and setting of items on this collection.
/// It should return an instance to replace editValue with, or editValue
/// if there is no need to replace the instance.
///
protected override object SetItems(object editValue, object[] value) {
if (editValue is Array || editValue == null) {
Array newArray = Array.CreateInstance(CollectionItemType, value.Length);
Array.Copy(value, newArray, value.Length);
return newArray;
}
return editValue;
}
}
}
// 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
- Control.cs
- MatrixConverter.cs
- PropertyConverter.cs
- BreakSafeBase.cs
- UriExt.cs
- Win32Native.cs
- StrongNameUtility.cs
- ApplicationId.cs
- HostExecutionContextManager.cs
- MembershipPasswordException.cs
- HttpHeaderCollection.cs
- CngKeyCreationParameters.cs
- DateBoldEvent.cs
- ResourceExpressionBuilder.cs
- CacheDependency.cs
- TabletDevice.cs
- WindowsProgressbar.cs
- InputBindingCollection.cs
- NameTable.cs
- AuthenticatedStream.cs
- SqlBooleanizer.cs
- MetabaseReader.cs
- NamespaceEmitter.cs
- PropertyTabChangedEvent.cs
- SendReply.cs
- TextElement.cs
- IntellisenseTextBox.cs
- SerializationObjectManager.cs
- TextBoxLine.cs
- NullableIntSumAggregationOperator.cs
- DelegateTypeInfo.cs
- Win32Exception.cs
- FacetChecker.cs
- EntityProxyFactory.cs
- ProfilePropertySettings.cs
- ButtonField.cs
- RootBuilder.cs
- HyperLinkDataBindingHandler.cs
- NetworkCredential.cs
- ToolboxDataAttribute.cs
- HttpFileCollectionBase.cs
- SqlBinder.cs
- UnsafeNativeMethodsCLR.cs
- InlineObject.cs
- FixedDocument.cs
- TranslateTransform3D.cs
- FlowDocumentPage.cs
- ButtonAutomationPeer.cs
- ScriptControl.cs
- DataServiceRequest.cs
- DocumentViewerBase.cs
- WebContext.cs
- TcpTransportSecurityElement.cs
- RichTextBox.cs
- FilterableAttribute.cs
- SelectingProviderEventArgs.cs
- LineServicesCallbacks.cs
- TreeViewImageKeyConverter.cs
- WebPartCatalogAddVerb.cs
- Size3DConverter.cs
- InputReferenceExpression.cs
- XmlSchemaComplexContentExtension.cs
- LOSFormatter.cs
- EnumConverter.cs
- WindowsMenu.cs
- XmlDataImplementation.cs
- ClockGroup.cs
- RootProfilePropertySettingsCollection.cs
- Thread.cs
- ListViewSortEventArgs.cs
- Decoder.cs
- NativeWindow.cs
- MaskPropertyEditor.cs
- AssemblyInfo.cs
- DataGridRow.cs
- StringPropertyBuilder.cs
- ToolStripContainer.cs
- Semaphore.cs
- TypeToken.cs
- XmlMapping.cs
- HttpListenerPrefixCollection.cs
- ManagementObject.cs
- WebReference.cs
- ListViewItemSelectionChangedEvent.cs
- PropertyIDSet.cs
- WindowsIdentity.cs
- JavaScriptObjectDeserializer.cs
- DivideByZeroException.cs
- UnsafeNativeMethods.cs
- RelatedEnd.cs
- MimeBasePart.cs
- PriorityRange.cs
- EncryptedReference.cs
- SafeNativeMethods.cs
- XomlSerializationHelpers.cs
- DWriteFactory.cs
- DataListCommandEventArgs.cs
- UnsafeNativeMethods.cs
- ConfigurationSectionHelper.cs
- sqlcontext.cs