Поделиться через


RemoteBindableComponent.BindingContext Свойство (2007 System)

Обновлен: Ноябрь 2007

Возвращает или задает объект System.Windows.Forms.BindingContext для компонента.

Пространство имен:  Microsoft.VisualStudio.Tools.Office
Сборка:  Microsoft.Office.Tools.v9.0 (в Microsoft.Office.Tools.v9.0.dll)

Синтаксис

'Декларация
<BrowsableAttribute(False)> _
Public Property BindingContext As BindingContext
'Применение
Dim instance As RemoteBindableComponent
Dim value As BindingContext

value = instance.BindingContext

instance.BindingContext = value
[BrowsableAttribute(false)]
public BindingContext BindingContext { get; set; }

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

Тип: System.Windows.Forms.BindingContext

Реализации

IBindableComponent.BindingContext

Заметки

Объект элемента управления System.Windows.Forms.BindingContext используется для возврата отдельного объекта BindingManagerBase для всех привязанных к данным компонентов, содержащихся в этом компоненте. Объект BindingManagerBase синхронизирует все компоненты, привязанные к одному источнику данных. Например, если настроить свойство Position объекта BindingManagerBase, в базовом списке будет определен пункт, на который указывают все компоненты, привязанные к данным.

Примеры

В следующем примере кода демонстрируется обработчик события ClickButton. При нажатии кнопки Button в примере используется свойство BindingContext для отображения следующего привязанного к данным элемента в NamedRange. Данный пример кода является частью большого примера для класса RemoteBindableComponent.

' Displays the next data item in the NamedRange.
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
    Handles button1.Click

    If Not (namedRange1.BindingContext Is Nothing) Then
        Dim bindingManager1 As BindingManagerBase = _
            namedRange1.BindingContext(ds, "Customers")

        ' Display the next item.
        If bindingManager1.Position < bindingManager1.Count - 1 Then
            bindingManager1.Position += 1

            ' Display the first item.
        Else
            bindingManager1.Position = 0
        End If
    End If
End Sub
// Displays the next data item in the NamedRange.
void button1_Click(object sender, EventArgs e)
{
    if (namedRange1.BindingContext != null)
    {
        BindingManagerBase bindingManager1 =
            namedRange1.BindingContext[ds, "Customers"];

        // Display the next item.
        if (bindingManager1.Position < bindingManager1.Count - 1)
        {
            bindingManager1.Position++;
        }

        // Display the first item.
        else
        {
            bindingManager1.Position = 0;
        }
    }
}

Разрешения

См. также

Ссылки

RemoteBindableComponent Класс

RemoteBindableComponent - члены

Microsoft.VisualStudio.Tools.Office - пространство имен