BindingManagerBase.GetItemProperties Method ()

 

When overridden in a derived class, gets the collection of property descriptors for the binding.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public virtual PropertyDescriptorCollection GetItemProperties()

Return Value

Type: System.ComponentModel.PropertyDescriptorCollection

A PropertyDescriptorCollection that represents the property descriptors for the binding.

The following code example uses the GetItemProperties method to return a PropertyDescriptorCollection. The example prints the Name and value of the current DataColumn using the GetValue method of the PropertyDescriptor.

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]));
}

.NET Framework
Available since 1.1
Return to top
Show: