BindingManagerBase.GetItemProperties Metodo

Definizione

Ottiene l'elenco dei descrittori di proprietà per l'origine dati.

Overload

GetItemProperties()

Quando viene sottoposto a override in una classe derivata, ottiene la raccolta di descrittori di proprietà per l'associazione.

GetItemProperties(ArrayList, ArrayList)

Ottiene l'insieme di descrittori di proprietà per l'associazione mediante il controllo ArrayList specificato.

GetItemProperties(Type, Int32, ArrayList, ArrayList)

Ottiene l'elenco delle proprietà degli elementi gestiti da questa classe BindingManagerBase.

GetItemProperties()

Quando viene sottoposto a override in una classe derivata, ottiene la raccolta di descrittori di proprietà per l'associazione.

public:
 abstract System::ComponentModel::PropertyDescriptorCollection ^ GetItemProperties();
public:
 virtual System::ComponentModel::PropertyDescriptorCollection ^ GetItemProperties();
public abstract System.ComponentModel.PropertyDescriptorCollection GetItemProperties ();
public virtual System.ComponentModel.PropertyDescriptorCollection GetItemProperties ();
abstract member GetItemProperties : unit -> System.ComponentModel.PropertyDescriptorCollection
abstract member GetItemProperties : unit -> System.ComponentModel.PropertyDescriptorCollection
override this.GetItemProperties : unit -> System.ComponentModel.PropertyDescriptorCollection
Public MustOverride Function GetItemProperties () As PropertyDescriptorCollection
Public Overridable Function GetItemProperties () As PropertyDescriptorCollection

Restituisce

PropertyDescriptorCollection

Oggetto PropertyDescriptorCollection che rappresenta i descrittori di proprietà per l'associazione.

Esempio

Nell'esempio di codice seguente viene usato il GetItemProperties metodo per restituire un PropertyDescriptorCollectionoggetto . Nell'esempio viene stampato il Name valore e dell'oggetto PropertyDescriptorcorrente DataColumn usando il GetValue metodo di .

void ShowGetItemProperties()
{
   
   // Create a new DataTable and add two columns.
   DataTable^ dt = gcnew 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 ] ) );
}
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]));
}
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

Vedi anche

Si applica a

GetItemProperties(ArrayList, ArrayList)

Ottiene l'insieme di descrittori di proprietà per l'associazione mediante il controllo ArrayList specificato.

protected public:
 virtual System::ComponentModel::PropertyDescriptorCollection ^ GetItemProperties(System::Collections::ArrayList ^ dataSources, System::Collections::ArrayList ^ listAccessors);
protected internal virtual System.ComponentModel.PropertyDescriptorCollection GetItemProperties (System.Collections.ArrayList dataSources, System.Collections.ArrayList listAccessors);
protected internal virtual System.ComponentModel.PropertyDescriptorCollection? GetItemProperties (System.Collections.ArrayList dataSources, System.Collections.ArrayList listAccessors);
abstract member GetItemProperties : System.Collections.ArrayList * System.Collections.ArrayList -> System.ComponentModel.PropertyDescriptorCollection
override this.GetItemProperties : System.Collections.ArrayList * System.Collections.ArrayList -> System.ComponentModel.PropertyDescriptorCollection
Protected Friend Overridable Function GetItemProperties (dataSources As ArrayList, listAccessors As ArrayList) As PropertyDescriptorCollection

Parametri

dataSources
ArrayList

Controllo ArrayList che contiene le origini dati.

listAccessors
ArrayList

Oggetto ArrayList che contiene le proprietà associate della tabella.

Restituisce

PropertyDescriptorCollection

Oggetto PropertyDescriptorCollection che rappresenta i descrittori di proprietà per l'associazione.

Commenti

Questo metodo viene usato dagli sviluppatori che creano controlli associati ai dati.

Vedi anche

Si applica a

GetItemProperties(Type, Int32, ArrayList, ArrayList)

Ottiene l'elenco delle proprietà degli elementi gestiti da questa classe BindingManagerBase.

protected:
 virtual System::ComponentModel::PropertyDescriptorCollection ^ GetItemProperties(Type ^ listType, int offset, System::Collections::ArrayList ^ dataSources, System::Collections::ArrayList ^ listAccessors);
protected virtual System.ComponentModel.PropertyDescriptorCollection GetItemProperties (Type listType, int offset, System.Collections.ArrayList dataSources, System.Collections.ArrayList listAccessors);
protected virtual System.ComponentModel.PropertyDescriptorCollection? GetItemProperties (Type listType, int offset, System.Collections.ArrayList dataSources, System.Collections.ArrayList listAccessors);
abstract member GetItemProperties : Type * int * System.Collections.ArrayList * System.Collections.ArrayList -> System.ComponentModel.PropertyDescriptorCollection
override this.GetItemProperties : Type * int * System.Collections.ArrayList * System.Collections.ArrayList -> System.ComponentModel.PropertyDescriptorCollection
Protected Overridable Function GetItemProperties (listType As Type, offset As Integer, dataSources As ArrayList, listAccessors As ArrayList) As PropertyDescriptorCollection

Parametri

listType
Type

Attributo Type dell'elenco associato.

offset
Int32

Contatore utilizzato per eseguire una chiamata ricorsiva del metodo.

dataSources
ArrayList

Controllo ArrayList che contiene le origini dati.

listAccessors
ArrayList

Oggetto ArrayList che contiene le proprietà associate della tabella.

Restituisce

PropertyDescriptorCollection

Oggetto PropertyDescriptorCollection che rappresenta i descrittori di proprietà per l'associazione.

Esempio

Nell'esempio di codice seguente viene usato il GetItemProperties metodo per restituire un PropertyDescriptorCollection oggetto per un BindingManagerBaseoggetto . L'esempio stampa quindi l'oggetto Name e PropertyType di ognuno PropertyDescriptor dell'insieme.

void PrintPropertyDescriptions( BindingManagerBase^ b )
{
   Console::WriteLine( "Printing Property Descriptions" );
   PropertyDescriptorCollection^ ps = b->GetItemProperties();
   for ( int i = 0; i < ps->Count; i++ )
   {
      Console::WriteLine( "\t{0}\t{1}", ps[ i ]->Name, ps[ i ]->PropertyType );

   }
}
private void PrintPropertyDescriptions(BindingManagerBase b)
{
   Console.WriteLine("Printing Property Descriptions");
   PropertyDescriptorCollection ps = b.GetItemProperties();
   for(int i = 0; i < ps.Count; i++)
   {
      Console.WriteLine("\t" + ps[i].Name + "\t" + ps[i].PropertyType);
   }
}
Private Sub PrintPropertyDescriptions(b As BindingManagerBase)
    Console.WriteLine("Printing Property Descriptions")
    Dim ps As PropertyDescriptorCollection = b.GetItemProperties()
    Dim i As Integer
    For i = 0 To ps.Count - 1
        Console.WriteLine((ControlChars.Tab & ps(i).Name & ControlChars.Tab & ps(i).PropertyType.ToString))
    Next i
End Sub

Commenti

Questo overload viene usato dagli sviluppatori per creare controlli associati ai dati.

Vedi anche

Si applica a