alexa
menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download

    Show / Hide Table of Contents

    Class WindowsFormsEditorServiceContainer

    Provides a basic implementation for the IWindowsFormsEditorService and IServiceProvider interfaces and can be used together with TypeDescriptorContext to launch an Editor directly outside a property grid.

    Inheritance
    System.Object
    WindowsFormsEditorServiceContainer
    Implements
    System.Windows.Forms.Design.IWindowsFormsEditorService
    System.IServiceProvider
    Namespace: Syncfusion.ComponentModel
    Assembly: Syncfusion.Shared.Base.dll
    Syntax
    public class WindowsFormsEditorServiceContainer : Object, IWindowsFormsEditorService, 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

    WindowsFormsEditorServiceContainer(IServiceProvider)

    Initializes a WindowsFormsEditorServiceContainer with the given IServiceProvider.

    Declaration
    public WindowsFormsEditorServiceContainer(IServiceProvider serviceProvider)
    Parameters
    Type Name Description
    System.IServiceProvider serviceProvider

    An IServiceProvider. Can be NULL.

    Properties

    DialogResult

    Returns the dialog result of the edit operation.

    Declaration
    public DialogResult DialogResult { get; }
    Property Value
    Type
    System.Windows.Forms.DialogResult

    ServiceProvider

    Gets / sets the associated IServiceProvider.

    Declaration
    public IServiceProvider ServiceProvider { get; set; }
    Property Value
    Type
    System.IServiceProvider

    Events

    ShowingDialog

    Occurs immediately before the Dialog is displayed. The ControlEventArgs.Control the form.

    Declaration
    public event ControlEventHandler ShowingDialog
    Event Type
    Type
    System.Windows.Forms.ControlEventHandler

    Implements

    System.Windows.Forms.Design.IWindowsFormsEditorService
    System.IServiceProvider

    See Also

    TypeDescriptorContext
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved