This topic has not yet been rated - Rate this topic

IExtenderListService Interface

Provides an interface that can list extender providers.

Namespace:  System.ComponentModel.Design
Assembly:  System (in System.dll)
public interface IExtenderListService

The IExtenderListService type exposes the following members.

  NameDescription
Public methodGetExtenderProvidersGets the set of extender providers for the component.
Top

A site can implement this service if it wants to provide a list of extender providers. By default, the list of extenders is generated by querying each component in the container that implements IExtenderProvider for the extenders each provides. By implementing this interface on a component site, a container can override the list of providers.

The following example demonstrates using the IExtenderListService to obtain the set of currently active extender providers.


using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace ExtenderListServiceExample
{
    // This control lists any active extender providers.
    public class ExtenderListServiceControl : System.Windows.Forms.UserControl
    {		
        private IExtenderListService extenderListService;
        private string[] extenderNames;

        public ExtenderListServiceControl()
        {			
            extenderNames = new string[0];
            this.Width = 600;
        }

        // Queries the IExtenderListService when the control is sited 
        // in design mode.
        public override System.ComponentModel.ISite Site
        {
            get
            {
                return base.Site;
            }
            set
            {
                base.Site = value;
                if( this.DesignMode )
                {
                    extenderListService = (IExtenderListService)this.GetService(typeof(IExtenderListService));
                    if( extenderListService != null )
                    {
                        IExtenderProvider[] extenders = extenderListService.GetExtenderProviders();
                        extenderNames = new string[extenders.Length];
                        for( int i=0; i<extenders.Length; i++ )
                            extenderNames[i] = "ExtenderProvider #"+i.ToString()+":  "+extenders[i].GetType().FullName;
                    }
                }
                else
                {
                    extenderListService = null;
                    extenderNames = new string[0];
                }
            }
        }

        // Draws a list of any active extender providers
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            if( extenderNames.Length == 0 )
                e.Graphics.DrawString("No active extender providers", new Font("Arial", 9), new SolidBrush(Color.Black), 10, 10);
            else
                e.Graphics.DrawString("List of types of active extender providers", new Font("Arial", 9), new SolidBrush(Color.Black), 10, 10);
            for(int i=0; i<extenderNames.Length; i++)
                e.Graphics.DrawString(extenderNames[i], new Font("Arial", 8), new SolidBrush(Color.Black), 10, 25+(i*10));
        }		
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.