DataGridColumnStyle.PropertyDescriptor DataGridColumnStyle.PropertyDescriptor DataGridColumnStyle.PropertyDescriptor DataGridColumnStyle.PropertyDescriptor Property

定義

PropertyDescriptor によって表示されたデータの属性を判断する DataGridColumnStyle を取得または設定します。Gets or sets the PropertyDescriptor that determines the attributes of data displayed by the 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; }
member this.PropertyDescriptor : System.ComponentModel.PropertyDescriptor with get, set
Public Overridable Property PropertyDescriptor As PropertyDescriptor

プロパティ値

列の属性に関するデータを格納している PropertyDescriptorA PropertyDescriptor that contains data about the attributes of the column.

次のコード例PropertyDescriptor GridColumnStylesCollectionでは、の列のを取得します。The following code example gets the PropertyDescriptor of a column in a GridColumnStylesCollection. 2番目の例でDataGridColumnStyleは、 PropertyDescriptorを使用して新しいを作成します。The second example creates a new DataGridColumnStyle with a 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

注釈

PropertyDescriptorのは、のGetItemPropertiesメソッドBindingManagerBaseを使用して設定されます。The PropertyDescriptor for a column is set using the GetItemProperties method of the BindingManagerBase. を使用して新しいDataGridColumnStyleを作成DataGridColumnStyle する例については、コンストラクターを参照PropertyDescriptorしてください。See the DataGridColumnStyle constructor for an example of using the PropertyDescriptor to create a new DataGridColumnStyle.

適用対象

こちらもご覧ください