Class TypeDescriptorContext
Provides a basic implementation for the ITypeDescriptorContext interface and can be used together with WindowsFormsEditorService to launch an Editor directly outside a property grid.
Inheritance
System.Object
TypeDescriptorContext
Implements
System.ComponentModel.ITypeDescriptorContext
System.IServiceProvider
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.ComponentModel
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class TypeDescriptorContext : ITypeDescriptorContext, IServiceProvider
Examples
The grid uses this class to display a collection editor:
public static DialogResult ShowGridBaseStylesMapDialog(object instance, string propertyName)
{
GridBaseStyleCollectionEditor ce = new GridBaseStyleCollectionEditor(typeof(ArrayList));
WindowsFormsEditorServiceContainer esc = new WindowsFormsEditorServiceContainer(null);
PropertyDescriptor pd = TypeDescriptor.GetProperties(instance)[propertyName];
TypeDescriptorContext tdc = new TypeDescriptorContext(instance, pd);
tdc.ServiceProvider = esc;
object v = ce.EditValue(tdc, esc, ((ICloneable) pd.GetValue(instance)).Clone());
if (esc.DialogResult == DialogResult.OK)
{
pd.SetValue(instance, v);
}
return esc.DialogResult;
}
Constructors
TypeDescriptorContext(Object, PropertyDescriptor)
Initializes a TypeDescriptorContext for the given object and PropertyDescriptor.
Declaration
public TypeDescriptorContext(object instance, PropertyDescriptor propertyDescriptor)
Parameters
Type | Name | Description |
---|---|---|
System.Object | instance | The instance of the property to be edited. |
System.ComponentModel.PropertyDescriptor | propertyDescriptor | A PropertyDescriptor that contains information about the property. |
Properties
ServiceProvider
Gets / sets the associated IServiceProvider.
Declaration
public IServiceProvider ServiceProvider { get; set; }
Property Value
Type | Description |
---|---|
System.IServiceProvider | An IServiceProvider value. |
Explicit Interface Implementations
IServiceProvider.GetService(Type)
Declaration
object IServiceProvider.GetService(Type classService)
Parameters
Type | Name | Description |
---|---|---|
System.Type | classService |
Returns
Type |
---|
System.Object |
Implements
System.ComponentModel.ITypeDescriptorContext
System.IServiceProvider