Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / AdvancedBindingPropertyDescriptor.cs / 1 / AdvancedBindingPropertyDescriptor.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms.Design {
using System.Design;
using System;
using System.ComponentModel;
///
///
/// Provides a property description of an advanced binding object.
///
internal class AdvancedBindingPropertyDescriptor : PropertyDescriptor {
internal static AdvancedBindingEditor advancedBindingEditor = new AdvancedBindingEditor();
internal static AdvancedBindingTypeConverter advancedBindingTypeConverter = new AdvancedBindingTypeConverter();
internal AdvancedBindingPropertyDescriptor() : base(SR.GetString(SR.AdvancedBindingPropertyDescName), null) {
}
///
///
/// Gets the type of component this property is bound to.
///
public override Type ComponentType {
get {
return typeof(ControlBindingsCollection);
}
}
public override AttributeCollection Attributes {
get {
return new AttributeCollection(new Attribute[]{new SRDescriptionAttribute(SR.AdvancedBindingPropertyDescriptorDesc),
NotifyParentPropertyAttribute.Yes,
new MergablePropertyAttribute(false)});
}
}
///
///
/// Indicates whether this property is read-only.
///
public override bool IsReadOnly {
get {
return false;
}
}
///
///
/// Gets the type of the property.
///
public override Type PropertyType {
get {
return typeof(object);
}
}
///
///
/// Gets the type converter.
///
public override TypeConverter Converter {
get {
if (advancedBindingTypeConverter == null) {
advancedBindingTypeConverter = new AdvancedBindingTypeConverter();
}
return advancedBindingTypeConverter;
}
}
///
///
/// Gets an editor of the specified type.
///
public override object GetEditor(Type type) {
if (type == typeof(System.Drawing.Design.UITypeEditor)) {
return advancedBindingEditor;
}
return base.GetEditor(type);
}
///
///
/// Indicates whether resetting the component will change the value of the
/// component.
///
public override bool CanResetValue(object component) {
return false;
}
///
///
/// In an derived class, adds the attributes of the inherited class to the
/// specified list of attributes in the parent class.
///
protected override void FillAttributes(System.Collections.IList attributeList) {
attributeList.Add(RefreshPropertiesAttribute.All);
base.FillAttributes(attributeList);
}
///
///
/// Gets the current value of the property on the specified
/// component.
///
public override object GetValue(object component) {
System.Diagnostics.Debug.Assert(component is ControlBindingsCollection, "we only deal w/ bindings collection");
return component;
}
///
///
/// Resets the value of the property on the specified component.
///
public override void ResetValue(object component) {
}
///
///
/// Sets the value of the property on the specified component to the specified
/// value.
///
public override void SetValue(object component, object value) {
}
///
///
/// Indicates whether the value of this property should be persisted.
///
public override bool ShouldSerializeValue(object component) {
return false;
}
internal class AdvancedBindingTypeConverter : TypeConverter {
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
System.Diagnostics.Debug.Assert(value is ControlBindingsCollection, "we only deal w/ bindings collection");
if (destinationType == typeof(String)) {
return String.Empty;
} else {
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
- HyperLinkColumn.cs
- DefaultTextStoreTextComposition.cs
- DragDrop.cs
- PropertySourceInfo.cs
- ClaimSet.cs
- DesignerDataRelationship.cs
- DynamicHyperLink.cs
- XmlDictionaryString.cs
- BuildDependencySet.cs
- WebPartVerbCollection.cs
- HandlerBase.cs
- filewebrequest.cs
- ExceptionValidationRule.cs
- WebRequestModuleElementCollection.cs
- CodeExporter.cs
- ReaderContextStackData.cs
- TimelineGroup.cs
- XmlSchemaException.cs
- LessThan.cs
- WaitHandleCannotBeOpenedException.cs
- ProcessProtocolHandler.cs
- WorkflowServiceAttributes.cs
- ProxyWebPartManager.cs
- Pen.cs
- ShaderRenderModeValidation.cs
- AttributeSetAction.cs
- StructuredType.cs
- FrameworkElementAutomationPeer.cs
- ContentTypeSettingDispatchMessageFormatter.cs
- MarkupExtensionReturnTypeAttribute.cs
- CapabilitiesSection.cs
- ZipFileInfo.cs
- XmlSchemaSimpleType.cs
- DelegatingTypeDescriptionProvider.cs
- PropertyChangeTracker.cs
- StringFreezingAttribute.cs
- HwndHostAutomationPeer.cs
- SimpleWorkerRequest.cs
- BypassElement.cs
- BinaryWriter.cs
- Cloud.cs
- IssuedSecurityTokenProvider.cs
- DecimalKeyFrameCollection.cs
- EndpointAddressAugust2004.cs
- HandlerFactoryWrapper.cs
- Int16Converter.cs
- MediaElement.cs
- EdmFunction.cs
- HostedHttpRequestAsyncResult.cs
- ToolStripContentPanel.cs
- EnumType.cs
- GridPattern.cs
- DesignerSerializerAttribute.cs
- StaticResourceExtension.cs
- FacetValues.cs
- XmlNamedNodeMap.cs
- CharacterShapingProperties.cs
- UserControlParser.cs
- DomainConstraint.cs
- InvokePattern.cs
- IIS7UserPrincipal.cs
- DoubleConverter.cs
- ExtensionDataObject.cs
- ExpressionDumper.cs
- EditorPartChrome.cs
- DataServiceBehavior.cs
- Avt.cs
- _AcceptOverlappedAsyncResult.cs
- StatusBar.cs
- ErrorItem.cs
- DynamicPropertyHolder.cs
- TextEditorContextMenu.cs
- SmiContextFactory.cs
- HtmlInputFile.cs
- entityreference_tresulttype.cs
- XsdSchemaFileEditor.cs
- MultiBinding.cs
- DataGridViewUtilities.cs
- UnknownWrapper.cs
- XmlSchemaNotation.cs
- RectangleConverter.cs
- DrawingContext.cs
- ResourceDisplayNameAttribute.cs
- SlotInfo.cs
- CompleteWizardStep.cs
- SemaphoreFullException.cs
- SQLString.cs
- DataSourceXmlElementAttribute.cs
- ResumeStoryboard.cs
- CrossSiteScriptingValidation.cs
- SurrogateDataContract.cs
- Helpers.cs
- _HeaderInfoTable.cs
- TraceRecord.cs
- ApplyTemplatesAction.cs
- SqlDataSourceCache.cs
- SecurityAlgorithmSuiteConverter.cs
- OperandQuery.cs
- StructuralCache.cs
- SqlClientPermission.cs