IExtenderListService Interface


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Provides an interface that can list extender providers.

Namespace:   System.ComponentModel.Design
Assembly:  System (in System.dll)

Public Interface IExtenderListService


Gets the set of extender providers for the component.

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.

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Data
Imports System.Windows.Forms

' This control lists any active extender providers.
Public Class ExtenderListServiceControl
   Inherits System.Windows.Forms.UserControl
   Private extenderListService As IExtenderListService
   Private extenderNames() As String

   Public Sub New()
      extenderNames = New String(-1) {}
      Me.Width = 600
    End Sub

    ' Queries the IExtenderListService when the control is sited 
    ' in design mode.
    Public Overrides Property Site() As System.ComponentModel.ISite
            Return MyBase.Site
        End Get
        Set(ByVal Value As System.ComponentModel.ISite)
            MyBase.Site = Value
            If Me.DesignMode Then
                extenderListService = CType(Me.GetService(GetType(IExtenderListService)), IExtenderListService)
                If (extenderListService IsNot Nothing) Then
                    Dim extenders As IExtenderProvider() = extenderListService.GetExtenderProviders()
                    extenderNames = New String(extenders.Length) {}
                    Dim i As Integer
                    For i = 0 To extenders.Length - 1
                        Dim types As Type() = Type.GetTypeArray(extenders)
                        extenderNames(i) = "ExtenderProvider #" + i.ToString() + ":  " + types(i).FullName
                    Next i
                End If
                extenderListService = Nothing
                extenderNames = New String(-1) {}
            End If
        End Set
    End Property

    ' Draws a list of any active extender providers
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        If extenderNames.Length = 0 Then
            e.Graphics.DrawString("No active extender providers", New Font("Arial", 9), New SolidBrush(Color.Black), 10, 10)
            e.Graphics.DrawString("List of types of active extender providers", New Font("Arial", 9), New SolidBrush(Color.Black), 10, 10)
        End If
        Dim i As Integer
        For i = 0 To extenderNames.Length - 1
            e.Graphics.DrawString(extenderNames(i), New Font("Arial", 8), New SolidBrush(Color.Black), 10, 25 + i * 10)
        Next i
    End Sub

End Class

.NET Framework
Available since 1.1
Return to top