BindingManagerBaseとは? わかりやすく解説

BindingManagerBase イベント


パブリック イベントパブリック イベント

  名前 説明
パブリック イベント BindingComplete データ バインディング操作完了時に発生します
パブリック イベント CurrentChanged 現在バインドされている項目が変更される発生します
パブリック イベント CurrentItemChanged 現在バインドされている項目の状態が変更されたときに発生します
パブリック イベント DataError Exception が BindingManagerBase によって処理され場合発生します
パブリック イベント PositionChanged Position プロパティの値が変更された後に発生します
参照参照

関連項目

BindingManagerBase クラス
System.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager

BindingManagerBase クラス

同じデータ ソースおよび同じデータ メンバ結合されBinding オブジェクトをすべて管理します。このクラス抽象クラスです。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public MustInherit Class
 BindingManagerBase
Dim instance As BindingManagerBase
public abstract class BindingManagerBase
public ref class BindingManagerBase abstract
public abstract class BindingManagerBase
public abstract class BindingManagerBase
解説解説

BindingManagerBase は、同じデータ ソースバインドされた Windows フォームデータ バインド コントロール同期できるようにします。データ ソースへのコントロールの単純バインディング詳細については、Binding クラストピック参照してください。たとえば、同じデータ ソース異なる列にバインドされた 2 つTextBox コントロール配置されているフォームがあるとしますデータ ソース顧客の名前を格納している DataTable であり、列には姓と名が格納されているとします。同じ顧客に対して正しい姓と名を同時に表示するには、この 2 つコントロール同期させますBindingManagerBase クラスから継承された CurrencyManager が、データ ソース現在の項目へのポインタ維持することで、この同期実行しますTextBox コントロールは、現在の項目にバインドされているため、同じ行の情報表示します現在の項目が変更されると、CurrencyManager が、すべての連結コントロールデータ更新するように通知します。さらに、Position プロパティ設定してコントロールが指す DataTable の行を指定できますデータ ソース内の行の数を確認するには、Count プロパティ使用します

データ ソース現在の項目のポインタ維持しているとは限らないため、CurrencyManager が必要です。たとえば、配列と ArrayList オブジェクトデータ ソースになる場合ありますが、現在の項目を返すプロパティ持っていません。現在の項目を取得するには、Current プロパティ使用します

PropertyManager も BindingManagerBase から継承されデータ ソース内の現在のオブジェクトプロパティではなくオブジェクト現在のプロパティ維持するために使用されます。このためPropertyManager対すPosition プロパティまたは Count プロパティ設定無効です。

BindingManagerBase作成するには、BindingContext クラス使用します。この操作では、管理されているデータ ソースに応じてCurrencyManager または PropertyManagerいずれか返されます。

ソリューション プログラマは、コントロールを BindingSource コンポーネント直接バインドすることをお勧めます。これは、データ ソースと、実際対象データ ソースへのデータ コネクタ両方として機能しますBindingSource により、コントロール対象の間の現在性の管理など、単純または複合データ バインディング大幅に簡素化されます。

継承時の注意 BindingManagerBase から継承する場合は、抽象メンバである AddNew、Count、CancelCurrentEdit、Current、EndCurrentEdit、GetItemProperties、OnCurrentChanged、Position、RemoveAt、ResumeBinding、SuspendBinding、および UpdateIsBinding をオーバーライドする必要があります

使用例使用例

BindingContext使用して特定のデータ ソースに対して BindingManagerBase返すコード例次に示します。この例では、モジュール宣言セクションmyBindingManagerBase宣言していることを前提にしています。さらに、この例では CurrentChanged イベントおよび PositionChanged イベントイベント デリゲート追加してます。最後に、この例には、Position プロパティインクリメントまたはデクリメントし、Positionリスト最初または最後の行に設定する 4 つメソッド (MoveNextMovePreviousMoveFirst、および MoveLast) が含まれています。リスト最後の行は、Count プロパティ使用して確認します

Private Sub GetBindingManagerBase
   ' CustomersToOrders is the RelationName of a DataRelation.
   ' Therefore, the list maintained by the BindingManagerBase is the
   ' list of orders that belong to a specific customer in the
   ' DataTable named Customers, found in DataSet.
   myBindingManagerBase = Me.BindingContext(DataSet1, _
   "Customers.CustomersToOrders")

   ' Adds delegates to the CurrentChanged and PositionChanged events.
   AddHandler myBindingManagerBase.PositionChanged, _
   AddressOf BindingManagerBase_PositionChanged
   AddHandler myBindingManagerBase.CurrentChanged, _
   AddressOf BindingManagerBase_CurrentChanged
End Sub

Private Sub BindingManagerBase_PositionChanged
 _
(sender As Object, e As
 EventArgs)

   ' Prints the new Position of the BindingManagerBase.
   Console.Write("Position Changed: ")
   Console.WriteLine(CType(sender, BindingManagerBase).Position)
End Sub

Private Sub BindingManagerBase_CurrentChanged
 _
(sender As Object, e As
 EventArgs)

   ' Prints the new value of the current object.
   Console.Write("Current Changed: ")
   Console.WriteLine(CType(sender, BindingManagerBase).Current)
End Sub

Private Sub MoveNext
   ' Increments the Position property value by one.
   myBindingManagerBase.Position += 1
End Sub

Private Sub MovePrevious
   ' Decrements the Position property value by one.
   myBindingManagerBase.Position -= 1
End Sub

Private Sub MoveFirst
   ' Goes to the first row in the list.
   myBindingManagerBase.Position = 0
End Sub

Private Sub MoveLast
   ' Goes to the last row in the list.
   myBindingManagerBase.Position = _
   myBindingManagerBase.Count - 1
End Sub
private void GetBindingManagerBase()
{
   /* CustomersToOrders is the RelationName of a DataRelation. 
   Therefore, the list maintained by the BindingManagerBase is the
   list of orders that belong to a specific customer in the 
   DataTable named Customers, found in DataSet1. */
   myBindingManagerBase = 
   this.BindingContext[DataSet1, "Customers.CustomersToOrders"];

   // Adds delegates to the CurrentChanged and PositionChanged events.
   myBindingManagerBase.PositionChanged += 
   new EventHandler(BindingManagerBase_PositionChanged);
   myBindingManagerBase.CurrentChanged +=
   new EventHandler(BindingManagerBase_CurrentChanged);
}

private void BindingManagerBase_PositionChanged
(object sender, EventArgs e)
{
   // Prints the new Position of the BindingManagerBase.
   Console.Write("Position Changed: ");
   Console.WriteLine(((BindingManagerBase)sender).Position);
}

private void BindingManagerBase_CurrentChanged
(object sender, EventArgs e)
{
   // Prints the new value of the current object.
   Console.Write("Current Changed: ");
   Console.WriteLine(((BindingManagerBase)sender).Current);
}

private void MoveNext()
{
   // Increments the Position property value by one.
   myBindingManagerBase.Position += 1;
}

private void MovePrevious()
{
   // Decrements the Position property value by one.
   myBindingManagerBase.Position -= 1;
}

private void MoveFirst()
{
   // Goes to the first row in the list.
   myBindingManagerBase.Position = 0;
}

private void MoveLast()
{
   // Goes to the last row in the list.
   myBindingManagerBase.Position = 
   myBindingManagerBase.Count - 1;
}

void GetBindingManagerBase()
{
   
   /* CustomersToOrders is the RelationName of a DataRelation. 
      Therefore, the list maintained by the BindingManagerBase is the
      list of orders that belong to a specific customer in the
 
      DataTable named Customers, found in DataSet1. */
   myBindingManagerBase = this->BindingContext[DataSet1, "Customers.CustomersToOrders"];
   
   // Adds delegates to the CurrentChanged and PositionChanged events.
   myBindingManagerBase->PositionChanged += gcnew EventHandler( this,
 &Form1::BindingManagerBase_PositionChanged );
   myBindingManagerBase->CurrentChanged += gcnew EventHandler( this,
 &Form1::BindingManagerBase_CurrentChanged );
}

void BindingManagerBase_PositionChanged( Object^ sender, EventArgs^
 /*e*/ )
{
   
   // Prints the new Position of the BindingManagerBase.
   Console::Write( "Position Changed: " );
   Console::WriteLine( (dynamic_cast<BindingManagerBase^>(sender))->Position
 );
}

void BindingManagerBase_CurrentChanged( Object^ sender, EventArgs^
 /*e*/ )
{
   
   // Prints the new value of the current object.
   Console::Write( "Current Changed: " );
   Console::WriteLine( (dynamic_cast<BindingManagerBase^>(sender))->Current
 );
}

void MoveNext()
{
   
   // Increments the Position property value by one.
   myBindingManagerBase->Position = myBindingManagerBase->Position + 1;
}

void MovePrevious()
{
   
   // Decrements the Position property value by one.
   myBindingManagerBase->Position = myBindingManagerBase->Position - 1;
}

void MoveFirst()
{
   
   // Goes to the first row in the list.
   myBindingManagerBase->Position = 0;
}

void MoveLast()
{
   
   // Goes to the last row in the list.
   myBindingManagerBase->Position = myBindingManagerBase->Count - 1;
}

private void GetBindingManagerBase()
{
    /* CustomersToOrders is the RelationName of a DataRelation. 
       Therefore, the list maintained by the BindingManagerBase is the
       list of orders that belong to a specific customer in the
 
       DataTable named Customers, found in dataSet1. 
     */
    myBindingManagerBase = this.get_BindingContext().get_Item(dataSet1,
 
        "Customers.CustomersToOrders");

    // Adds delegates to the CurrentChanged and PositionChanged events.
    myBindingManagerBase.add_PositionChanged(new EventHandler
        (BindingManagerBase_PositionChanged));
    myBindingManagerBase.add_CurrentChanged(new EventHandler
        (BindingManagerBase_CurrentChanged));
} //GetBindingManagerBase

private void BindingManagerBase_PositionChanged(Object
 sender, EventArgs e)
{
    // Prints the new Position of the BindingManagerBase.
    Console.Write("Position Changed: ");
    Console.WriteLine(((BindingManagerBase)(sender)).get_Position());
} //BindingManagerBase_PositionChanged

private void BindingManagerBase_CurrentChanged(Object
 sender, EventArgs e)
{
    // Prints the new value of the current object.
    Console.Write("Current Changed: ");
    Console.WriteLine(((BindingManagerBase)(sender)).get_Current());
} //BindingManagerBase_CurrentChanged

private void MoveNext()
{
    // Increments the Position property value by one.
    myBindingManagerBase.set_Position(myBindingManagerBase.get_Position()
        + 1);
} //MoveNext

private void MovePrevious()
{
    // Decrements the Position property value by one.
    myBindingManagerBase.set_Position(myBindingManagerBase.get_Position()
        - 1);
} //MovePrevious

private void MoveFirst()
{
    // Goes to the first row in the list.
    myBindingManagerBase.set_Position(0);
} //MoveFirst

private void MoveLast()
{
    // Goes to the last row in the list.
    myBindingManagerBase.set_Position(myBindingManagerBase.get_Count() - 1);
} //MoveLast
継承階層継承階層
System.Object
  System.Windows.Forms.BindingManagerBase
     System.Windows.Forms.CurrencyManager
     System.Windows.Forms.PropertyManager
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
BindingManagerBase メンバ
System.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager

BindingManagerBase コンストラクタ


BindingManagerBase フィールド


プロテクト フィールドプロテクト フィールド

  名前 説明
プロテクト フィールド onCurrentChangedHandler CurrentChanged イベントイベント ハンドラ指定します
プロテクト フィールド onPositionChangedHandler PositionChanged イベントイベント ハンドラ指定します
参照参照

関連項目

BindingManagerBase クラス
System.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager

BindingManagerBase プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Position 派生クラスオーバーライドされると、このデータ ソースバインドされたコントロールが指す、基になるリストでの位置取得または設定します
参照参照

関連項目

BindingManagerBase クラス
System.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager

BindingManagerBase メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド AddNew 派生クラスオーバーライドされると、基になるリスト新しい項目を追加します
パブリック メソッド CancelCurrentEdit 派生クラスオーバーライドされると、現在の編集キャンセルします
パブリック メソッド EndCurrentEdit 派生クラスオーバーライドされると、現在の編集終了します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetItemProperties オーバーロードされますデータ ソースプロパティ記述子リスト取得します
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド RemoveAt 派生クラスオーバーライドされると、基になるリストから指定されインデックス対応する行を削除します
パブリック メソッド ResumeBinding 派生クラスオーバーライドされると、データ連結再開します
パブリック メソッド SuspendBinding 派生クラスオーバーライドされると、データ連結中断します
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

BindingManagerBase クラス
System.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager

BindingManagerBase メンバ

同じデータ ソースおよび同じデータ メンバ結合されBinding オブジェクトをすべて管理します。このクラス抽象クラスです。

BindingManagerBase データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド BindingManagerBase BindingManagerBase クラス新しインスタンス初期化します。
プロテクト フィールドプロテクト フィールド
  名前 説明
プロテクト フィールド onCurrentChangedHandler CurrentChanged イベントイベント ハンドラ指定します
プロテクト フィールド onPositionChangedHandler PositionChanged イベントイベント ハンドラ指定します
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Position 派生クラスオーバーライドされると、このデータ ソースバインドされたコントロールが指す、基になるリストでの位置取得または設定します
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド AddNew 派生クラスオーバーライドされると、基になるリスト新しい項目を追加します
パブリック メソッド CancelCurrentEdit 派生クラスオーバーライドされると、現在の編集キャンセルします
パブリック メソッド EndCurrentEdit 派生クラスオーバーライドされると、現在の編集終了します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetItemProperties オーバーロードされますデータ ソースプロパティ記述子リスト取得します
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド RemoveAt 派生クラスオーバーライドされると、基になるリストから指定されインデックス対応する行を削除します
パブリック メソッド ResumeBinding 派生クラスオーバーライドされると、データ連結再開します
パブリック メソッド SuspendBinding 派生クラスオーバーライドされると、データ連結中断します
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
パブリック イベントパブリック イベント
  名前 説明
パブリック イベント BindingComplete データ バインディング操作完了時に発生します
パブリック イベント CurrentChanged 現在バインドされている項目が変更される発生します
パブリック イベント CurrentItemChanged 現在バインドされている項目の状態が変更されたときに発生します
パブリック イベント DataError ExceptionBindingManagerBase によって処理され場合発生します
パブリック イベント PositionChanged Position プロパティの値が変更された後に発生します
参照参照

関連項目

BindingManagerBase クラス
System.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「BindingManagerBase」の関連用語

BindingManagerBaseのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



BindingManagerBaseのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS