IListSource 인터페이스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
데이터 원본에 바인딩할 수 있는 목록을 반환하는 기능을 개체에 제공합니다.
public interface class IListSource
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public interface IListSource
public interface IListSource
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public interface IListSource
[<System.ComponentModel.TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
type IListSource = interface
type IListSource = interface
[<System.ComponentModel.TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
type IListSource = interface
Public Interface IListSource
- 파생
- 특성
예제
다음 코드 예제는 IListSource 인터페이스를 구현하는 방법을 설명합니다. 명명된 EmployeeListSource 구성 요소는 메서드를 IList 구현하여 데이터 바인딩을 노출합니다 GetList . 전체 코드 목록은 방법: IListSource 인터페이스 구현을 참조하세요.
using System.ComponentModel;
namespace IListSourceCS;
public class EmployeeListSource : Component, IListSource
{
public EmployeeListSource() { }
public EmployeeListSource(IContainer container) => container.Add(this);
#region IListSource Members
bool IListSource.ContainsListCollection => false;
System.Collections.IList IListSource.GetList()
{
BindingList<Employee> ble = DesignMode
? []
: [
new("Aaberg, Jesper", 26000000),
new ("Aaberg, Jesper", 26000000),
new ("Cajhen, Janko", 19600000),
new ("Furse, Kari", 19000000),
new ("Langhorn, Carl", 16000000),
new ("Todorov, Teodor", 15700000),
new ("Verebélyi, Ágnes", 15700000)
];
return ble;
}
#endregion
}
Imports System.ComponentModel
Public Class EmployeeListSource
Inherits Component
Implements IListSource
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#Region "IListSource Members"
Public ReadOnly Property ContainsListCollection() As Boolean Implements System.ComponentModel.IListSource.ContainsListCollection
Get
Return False
End Get
End Property
Public Function GetList() As System.Collections.IList Implements System.ComponentModel.IListSource.GetList
Dim ble As New BindingList(Of Employee)
If Not Me.DesignMode Then
ble.Add(New Employee("Aaberg, Jesper", 26000000))
ble.Add(New Employee("Cajhen, Janko", 19600000))
ble.Add(New Employee("Furse, Kari", 19000000))
ble.Add(New Employee("Langhorn, Carl", 16000000))
ble.Add(New Employee("Todorov, Teodor", 15700000))
ble.Add(New Employee("Verebélyi, Ágnes", 15700000))
End If
Return ble
End Function
#End Region
End Class
설명
일반적으로 이 인터페이스를 사용하여 자신을 구현 IList 하지 않는 개체에서 데이터 원본에 바인딩할 수 있는 목록을 반환합니다.
데이터에 대한 바인딩은 런타임 또는 디자이너에서 발생할 수 있지만 각각에 대한 규칙이 있습니다. 런타임에 다음 중 하나로 데이터에 바인딩할 수 있습니다.
구현자에 강력한 형식 Item[] 의 IList속성이 있는 경우의 구현자(즉, Type 아무것도 아닌 Object경우)입니다. 프라이빗의 Item[] 기본 구현을 수행하여 이 작업을 수행할 수 있습니다. 강력한 형식의 컬렉션의 규칙을 따르는 항목을 만들 IList 려면 .에서 CollectionBase파생해야 합니다.
의 구현자입니다 ITypedList.
디자이너에서 동일한 규칙을 따라 개체에 대한 바인딩을 초기화할 Component 수 있습니다.
Note
구현자는 IListSource 개체 컬렉션 IList 이 포함된 항목을 반환 IList 할 수 있습니다.
속성
| Name | Description |
|---|---|
| ContainsListCollection |
컬렉션 IList 이 개체 컬렉션인지 여부를 나타내는 값을 가져옵니다. |
메서드
| Name | Description |
|---|---|
| GetList() |
적용 대상
추가 정보
- IListSource
- ITypedList
- BindingList<T>
- IBindingList
- CollectionBase
- 데이터 바인딩 및 윈도우즈 폼즈