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
Namespace: Syncfusion.ComponentModel
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class TypeDescriptorContext : Object, 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. |
Implements
System.ComponentModel.ITypeDescriptorContext
System.IServiceProvider