Permalink
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (43 sloc) 2.75 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
How to: Implement the IListSource Interface
03/30/2017
.net-framework
dotnet-winforms
article
jsharp
data binding, implementing
IListSource interface
63ce27aa-2e23-4fbd-8228-0c1726f6c421
6
dotnet-bot
dotnetcontent
wpickett

How to: Implement the IListSource Interface

Implement the xref:System.ComponentModel.IListSource interface to create a bindable class that does not implement xref:System.Collections.IList but instead provides a list from another location.

Example

The following code example demonstrates how to implement the xref:System.ComponentModel.IListSource interface. A component named EmployeeListSource exposes an xref:System.Collections.IList for data binding by implementing the xref:System.ComponentModel.IListSource.GetList%2A method.

[!code-csharpSystem.ComponentModel.IListSource#1] [!code-vbSystem.ComponentModel.IListSource#1]

[!code-csharpSystem.ComponentModel.IListSource#10] [!code-vbSystem.ComponentModel.IListSource#10]

[!code-csharpSystem.ComponentModel.IListSource#100] [!code-vbSystem.ComponentModel.IListSource#100]

[!code-csharpSystem.ComponentModel.IListSource#1000] [!code-vbSystem.ComponentModel.IListSource#1000]

Compiling the Code

This example requires:

  • References to the System.Drawing and System.Windows.Forms assemblies.

See Also

xref:System.ComponentModel.IListSource
xref:System.ComponentModel.ITypedList
xref:System.ComponentModel.BindingList%601
xref:System.ComponentModel.IBindingList
Data Binding and Windows Forms