Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewRowConverter.cs / 1 / DataGridViewRowConverter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.Windows.Forms {
using System.Runtime.Serialization.Formatters;
using System.Runtime.Remoting;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Drawing;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
internal class DataGridViewRowConverter : ExpandableObjectConverter {
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
if (destinationType == typeof(InstanceDescriptor)) {
return true;
}
return base.CanConvertTo(context, destinationType);
}
///
/// Converts the given object to another type. The most common types to convert
/// are to and from a string object. The default implementation will make a call
/// to ToString on the object if the object is valid and if the destination
/// type is string. If this cannot convert to the desitnation type, this will
/// throw a NotSupportedException.
///
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
if (destinationType == null) {
throw new ArgumentNullException("destinationType");
}
DataGridViewRow dataGridViewRow = value as DataGridViewRow;
if (destinationType == typeof(InstanceDescriptor) && dataGridViewRow != null) {
// public DataGridViewRow()
//
ConstructorInfo ctor = dataGridViewRow.GetType().GetConstructor(new Type[0]);
if (ctor != null) {
return new InstanceDescriptor(ctor, new object[0], false);
}
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
}
// 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
- ComboBox.cs
- CFStream.cs
- ProcessModule.cs
- WorkItem.cs
- IPHostEntry.cs
- ImportCatalogPart.cs
- CryptoKeySecurity.cs
- ConfigurationManagerInternalFactory.cs
- PriorityBindingExpression.cs
- RawStylusInputCustomDataList.cs
- DataGridItemCollection.cs
- GridItemPattern.cs
- InitializingNewItemEventArgs.cs
- RadioButtonStandardAdapter.cs
- GeneralTransform2DTo3DTo2D.cs
- TypeSource.cs
- XamlRtfConverter.cs
- EventArgs.cs
- ReflectionUtil.cs
- TextElementEditingBehaviorAttribute.cs
- SafeTimerHandle.cs
- DebugView.cs
- ArgumentException.cs
- dataprotectionpermissionattribute.cs
- XmlNodeWriter.cs
- ConfigXmlElement.cs
- coordinator.cs
- Size.cs
- PackageProperties.cs
- WebPartChrome.cs
- AnonymousIdentificationModule.cs
- ProfilePropertySettingsCollection.cs
- ConfigurationElement.cs
- validationstate.cs
- DecimalConverter.cs
- ImageClickEventArgs.cs
- CompModSwitches.cs
- FrameworkRichTextComposition.cs
- State.cs
- TypedReference.cs
- PropertyValueUIItem.cs
- ScrollChrome.cs
- TextFormattingConverter.cs
- figurelength.cs
- BasicExpressionVisitor.cs
- MaskDescriptors.cs
- ToolTip.cs
- MarkupWriter.cs
- EntityTemplateFactory.cs
- MasterPageCodeDomTreeGenerator.cs
- TypeBuilderInstantiation.cs
- DesignerLoader.cs
- BamlLocalizableResource.cs
- BaseComponentEditor.cs
- DataGridViewDataErrorEventArgs.cs
- MemberRelationshipService.cs
- SqlFactory.cs
- DragStartedEventArgs.cs
- DbDataSourceEnumerator.cs
- ErrorItem.cs
- AppSettingsSection.cs
- ArrangedElementCollection.cs
- Accessible.cs
- ServiceManagerHandle.cs
- TriggerCollection.cs
- StoragePropertyMapping.cs
- ScrollViewer.cs
- SqlClientPermission.cs
- DataSet.cs
- DatatypeImplementation.cs
- RichTextBox.cs
- ScriptRegistrationManager.cs
- BamlResourceSerializer.cs
- ApplicationTrust.cs
- EncryptedReference.cs
- Trace.cs
- ping.cs
- GenericXmlSecurityToken.cs
- XmlSchemaImport.cs
- UInt32Converter.cs
- StylusDownEventArgs.cs
- OSFeature.cs
- AutomationIdentifier.cs
- PolyLineSegment.cs
- Image.cs
- StaticResourceExtension.cs
- SourceElementsCollection.cs
- basevalidator.cs
- WebBrowserDocumentCompletedEventHandler.cs
- ProfileManager.cs
- ControlCollection.cs
- NetStream.cs
- StorageSetMapping.cs
- RegexGroup.cs
- ListSourceHelper.cs
- StrokeRenderer.cs
- WebServiceErrorEvent.cs
- ListParagraph.cs
- IntSecurity.cs
- ICspAsymmetricAlgorithm.cs