Бөлісу құралы:


Binding.PropertyName Свойство

Определение

Возвращает имя свойства, привязанного к данным элемента управления.

public:
 property System::String ^ PropertyName { System::String ^ get(); };
public string PropertyName { get; }
member this.PropertyName : string
Public ReadOnly Property PropertyName As String

Значение свойства

Имя свойства элемента управления для привязки.

Примеры

В следующем примере PropertyName кода выводится значение каждого Binding элемента управления в форме.

private:
   void PrintPropertyNameAndIsBinding()
   {
      for each ( Control^ thisControl in this->Controls)
      {
         for each ( Binding^ thisBinding in thisControl->DataBindings )
         {
            Console::WriteLine( "\n {0}", thisControl );
            // Print the PropertyName value for each binding.
            Console::WriteLine( thisBinding->PropertyName );
         }
      }
   }
private void PrintPropertyNameAndIsBinding()
{
   foreach(Control thisControl in this.Controls)
   {
      foreach(Binding thisBinding in thisControl.DataBindings)
      {
         Console.WriteLine("\n" + thisControl.ToString());
         // Print the PropertyName value for each binding.
         Console.WriteLine(thisBinding.PropertyName);
      }
   }
}
Private Sub PrintPropertyNameAndIsBinding
    Dim thisControl As Control
    Dim thisBinding As Binding
    For Each thisControl In Me.Controls
        For Each thisBinding In thisControl.DataBindings
            Console.WriteLine(ControlChars.CrLf & thisControl.ToString)
            ' Print the PropertyName value for each binding.
            Console.WriteLine(thisBinding.PropertyName)
        Next
    Next
End Sub

Комментарии

PropertyName Используйте свойство элемента управления, которое требуется привязать к списку в источнике данных. Чаще всего привязывается свойство отображения, например Text свойство TextBox элемента управления. Однако, так как можно привязать любое свойство элемента управления, можно программно создавать элементы управления во время выполнения с помощью данных из базы данных.

Применяется к