BindingList<T> コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
BindingList<T> クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| BindingList<T>() |
既定値を使用して、 BindingList<T> クラスの新しいインスタンスを初期化します。 |
| BindingList<T>(IList<T>) |
指定したリストを使用して、 BindingList<T> クラスの新しいインスタンスを初期化します。 |
BindingList<T>()
既定値を使用して、 BindingList<T> クラスの新しいインスタンスを初期化します。
public:
BindingList();
public BindingList();
Public Sub New ()
例
次のコード例は、新しい BindingList<T>を構築する方法を示しています。 完全な例については、 BindingList<T> クラスの概要に関するトピックを参照してください。
// Declare a new BindingListOfT with the Part business object.
BindingList<Part> listOfParts;
void InitializeListOfParts()
{
// Create the new BindingList of Part type.
listOfParts = new BindingList<Part>
{
// Allow new parts to be added, but not removed once committed.
AllowNew = true,
AllowRemove = false,
// Raise ListChanged events when new parts are added.
RaiseListChangedEvents = true,
// Do not allow parts to be edited.
AllowEdit = false
};
// Add a couple of parts to the list.
listOfParts.Add(new Part("Widget", 1234));
listOfParts.Add(new Part("Gadget", 5647));
}
' Declare a new BindingListOfT with the Part business object.
Private WithEvents listOfParts As BindingList(Of Part)
Private Sub InitializeListOfParts()
' Create the new BindingList of Part type.
listOfParts = New BindingList(Of Part)
' Allow new parts to be added, but not removed once committed.
listOfParts.AllowNew = True
listOfParts.AllowRemove = False
' Raise ListChanged events when new parts are added.
listOfParts.RaiseListChangedEvents = True
' Do not allow parts to be edited.
listOfParts.AllowEdit = False
' Add a couple of parts to the list.
listOfParts.Add(New Part("Widget", 1234))
listOfParts.Add(New Part("Gadget", 5647))
End Sub
注釈
次の表に、 BindingList<T> クラスのインスタンスの初期プロパティ値を示します。
| 財産 | 初期値 |
|---|---|
| AllowEdit | true |
| AllowNew |
true リスト型にパラメーターなしのコンストラクターがある場合。それ以外の場合は false。 |
| AllowRemove | true |
| RaiseListChangedEvents | true |
こちらもご覧ください
適用対象
BindingList<T>(IList<T>)
指定したリストを使用して、 BindingList<T> クラスの新しいインスタンスを初期化します。
public:
BindingList(System::Collections::Generic::IList<T> ^ list);
public BindingList(System.Collections.Generic.IList<T> list);
new System.ComponentModel.BindingList<'T> : System.Collections.Generic.IList<'T> -> System.ComponentModel.BindingList<'T>
Public Sub New (list As IList(Of T))
パラメーター
- list
- IList<T>
BindingList<T>に含める項目のIList<T>。
注釈
このBindingList<T>を使用して、listによってサポートされるBindingList<T>を作成します。これにより、listへの変更がBindingList<T>に反映されます。
次の表に、 BindingList<T> クラスのインスタンスの初期プロパティ値を示します。
| 財産 | 初期値 |
|---|---|
| AllowEdit | true |
| AllowNew |
true リスト型にパラメーターなしのコンストラクターがある場合。それ以外の場合は false。 |
| AllowRemove | true |
| RaiseListChangedEvents | true |