派生クラスでオーバーライドされると、バインディングのプロパティ記述子のコレクションを取得します。
Overloads Public MustOverride Function GetItemProperties() As _
PropertyDescriptorCollection
[C#]
public abstract PropertyDescriptorCollection GetItemProperties();
[C++]
public: virtual PropertyDescriptorCollection* GetItemProperties() = 0;
[JScript]
public abstract function GetItemProperties() :
PropertyDescriptorCollection;
戻り値
バインディングのプロパティ記述子を表す PropertyDescriptorCollection 。
使用例
[Visual Basic, C#, C++] GetItemProperties メソッドを使用して、 PropertyDescriptorCollection を返す例を次に示します。この例では、 Name と現在の DataColumn の値を、 PropertyDescriptor オブジェクトの GetValue メソッドを使用して出力します。
Private Sub ShowGetItemProperties()
' Create a new DataTable and add two columns.
Dim dt As New DataTable()
dt.Columns.Add("Name", Type.GetType("System.String"))
dt.Columns.Add("ID", Type.GetType("System.String"))
' Add a row to the table.
Dim dr As DataRow = dt.NewRow()
dr("Name") = "Ann"
dr("ID") = "AAA"
dt.Rows.Add(dr)
Dim myPropertyDescriptors As PropertyDescriptorCollection = _
Me.BindingContext(dt).GetItemProperties()
Dim myPropertyDescriptor As PropertyDescriptor = myPropertyDescriptors("Name")
Console.WriteLine(myPropertyDescriptor.Name)
Console.WriteLine(myPropertyDescriptor.GetValue(dt.DefaultView(0)))
End Sub 'ShowGetItemProperties
[C#]
private void ShowGetItemProperties()
{
// Create a new DataTable and add two columns.
DataTable dt = new DataTable();
dt.Columns.Add("Name", Type.GetType("System.String"));
dt.Columns.Add("ID", Type.GetType("System.String"));
// Add a row to the table.
DataRow dr = dt.NewRow();
dr["Name"] = "Ann";
dr["ID"] = "AAA";
dt.Rows.Add(dr);
PropertyDescriptorCollection myPropertyDescriptors =
this.BindingContext[dt].GetItemProperties();
PropertyDescriptor myPropertyDescriptor =
myPropertyDescriptors["Name"];
Console.WriteLine(myPropertyDescriptor.Name);
Console.WriteLine(myPropertyDescriptor.GetValue
(dt.DefaultView[0]));
}
[C++]
private:
void ShowGetItemProperties()
{
// Create a new DataTable and add two columns.
DataTable* dt = new DataTable();
dt->Columns->Add(S"Name", Type::GetType(S"System.String"));
dt->Columns->Add(S"ID", Type::GetType(S"System.String"));
// Add a row to the table.
DataRow* dr = dt->NewRow();
dr->Item[S"Name"] = S"Ann";
dr->Item[S"ID"] = S"AAA";
dt->Rows->Add(dr);
PropertyDescriptorCollection* myPropertyDescriptors =
this->BindingContext->Item[dt]->GetItemProperties();
PropertyDescriptor* myPropertyDescriptor =
myPropertyDescriptors->Item[S"Name"];
Console::WriteLine(myPropertyDescriptor->Name);
Console::WriteLine(myPropertyDescriptor->GetValue(dt->DefaultView->Item[0]));
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
BindingManagerBase クラス | BindingManagerBase メンバ | System.Windows.Forms 名前空間 | BindingManagerBase.GetItemProperties オーバーロードの一覧