IExtenderListService Interface

Provides an interface that can list extender providers.

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

public interface class 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.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::ComponentModel::Design;
using namespace System::Windows::Forms;

namespace ExtenderListServiceExample
{
   // This control lists any active extender providers. 
   public ref class ExtenderListServiceControl: public UserControl
   {
   private:
      IExtenderListService^ extenderListService;
      array<String^>^extenderNames;

   public:
      ExtenderListServiceControl()
      {
         this->Width = 600;
      }

      property ISite^ Site 
      {
         // Queries the IExtenderListService when the control is sited 
         // in design mode. 
         virtual ISite^ get() override
         {
            return __super::Site;
         }

         virtual void set( ISite^ value ) override
         {
            __super::Site = value;
            if ( this->DesignMode )
            {
               extenderListService = dynamic_cast<IExtenderListService^>(this->GetService( IExtenderListService::typeid ));
               if ( extenderListService != nullptr )
               {
                  array<IExtenderProvider^>^extenders = extenderListService->GetExtenderProviders();
                  extenderNames = gcnew array<String^>(extenders->Length);
                  for ( int i = 0; i < extenders->Length; i++ )
                     extenderNames[ i ] = String::Concat( "ExtenderProvider #", i.ToString(), ":  ", extenders[ i ]->GetType()->FullName );
               }
            }
            else
            {
               extenderListService = nullptr;
            }
         }
      }

   protected:

      // Draws a list of any active extender providers 
      virtual void OnPaint( PaintEventArgs^ e ) override
      {
         if ( extenderNames->Length == 0 )
                  e->Graphics->DrawString( "No active extender providers", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 10, 10 );
         else
                  e->Graphics->DrawString( "List of types of active extender providers", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 10, 10 );

         for ( int i = 0; i < extenderNames->Length; i++ )
            e->Graphics->DrawString( extenderNames[ i ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 10, 25 + (i * 10) );
      }
   };
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft