DataGridColumnStyle.PropertyDescriptor Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta l'oggetto PropertyDescriptor che determina gli attributi dei dati visualizzati dall'oggetto DataGridColumnStyle.
public:
virtual property System::ComponentModel::PropertyDescriptor ^ PropertyDescriptor { System::ComponentModel::PropertyDescriptor ^ get(); void set(System::ComponentModel::PropertyDescriptor ^ value); };
[System.ComponentModel.Browsable(false)]
public virtual System.ComponentModel.PropertyDescriptor PropertyDescriptor { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.PropertyDescriptor : System.ComponentModel.PropertyDescriptor with get, set
Public Overridable Property PropertyDescriptor As PropertyDescriptor
Valore della proprietà
Oggetto PropertyDescriptor che contiene i dati sugli attributi della colonna.
- Attributi
Esempio
L'esempio di codice seguente ottiene l'oggetto PropertyDescriptor di una colonna in un oggetto GridColumnStylesCollection. Il secondo esempio crea un nuovo DataGridColumnStyle oggetto con un oggetto PropertyDescriptor.
private:
void GetPropertyDescriptor()
{
PropertyDescriptor^ pd;
pd = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]->PropertyDescriptor;
Console::WriteLine( pd );
}
void CreateNewDataGridColumnStyle()
{
GridColumnStylesCollection^ myGridColumnCol;
myGridColumnCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles;
// Get the CurrencyManager for the table you want to add a column to.
CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(this->BindingContext[ ds->Tables[ "Suppliers" ] ]);
// Get the PropertyDescriptor for the DataColumn of the new column.
PropertyDescriptor^ pd = myCurrencyManager->GetItemProperties()[ "City" ];
DataGridColumnStyle^ myColumn = gcnew DataGridTextBoxColumn( pd );
myGridColumnCol->Add( myColumn );
}
private void GetPropertyDescriptor()
{
PropertyDescriptor pd;
pd = dataGrid1.TableStyles[0].GridColumnStyles[0].PropertyDescriptor;
Console.WriteLine(pd.ToString());
}
private void CreateNewDataGridColumnStyle()
{
GridColumnStylesCollection myGridColumnCol;
myGridColumnCol = dataGrid1.TableStyles[0].GridColumnStyles;
// Get the CurrencyManager for the table you want to add a column to.
CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[ds.Tables["Suppliers"]];
// Get the PropertyDescriptor for the DataColumn of the new column.
PropertyDescriptor pd = myCurrencyManager.GetItemProperties()["City"];
DataGridColumnStyle myColumn = new DataGridTextBoxColumn(pd);
myGridColumnCol.Add(myColumn);
}
Private Sub GetPropertyDescriptor()
Dim pd As PropertyDescriptor
pd = dataGrid1.TableStyles(0).GridColumnStyles(0).PropertyDescriptor
Console.WriteLine(pd.ToString())
End Sub
Private Sub CreateNewDataGridColumnStyle()
Dim myGridColumnCol As GridColumnStylesCollection
myGridColumnCol = dataGrid1.TableStyles(0).GridColumnStyles
' Get the CurrencyManager for the table you want to add a column to.
Dim myCurrencyManager As CurrencyManager = CType(Me.BindingContext(ds.Tables("Suppliers")), CurrencyManager)
' Get the PropertyDescriptor for the DataColumn of the new column.
Dim pd As PropertyDescriptor = myCurrencyManager.GetItemProperties()("City")
Dim myColumn As New DataGridTextBoxColumn(pd)
myGridColumnCol.Add(myColumn)
End Sub
Commenti
L'oggetto PropertyDescriptor per una colonna viene impostato usando il GetItemProperties metodo di BindingManagerBase. Vedere il DataGridColumnStyle costruttore per un esempio di utilizzo PropertyDescriptor di per creare un nuovo DataGridColumnStyleoggetto .