How To : Binding a Control to an Object

Back to Concepts and HOW TOs

Contents

[edit] Description

This document describes how to bind a control to an object (assign the same control adapter to both the control and the object). It also describes how to delete a control from a form.

[edit] Prerequisites

Understanding Control Bindings
Introduction to Bungee Builder
Overview : Building a Bungee-powered Application

[edit] Procedures

To autobind a control to an object:

  1. In the Solution Explorer or Solution Detail, select the class member to which you want the control to be bound.
  2. In the Toolbox, from the Selection section (usually the top-most toolbox section), drag the control onto the form (in the Design Editor). The act of dragging out of the Selected category onto the form autobinds the control (the View) to the Model (the class member). This has the effect of implicitly assigning the same control adapter to both the control and the class member, thus enabling runtime binding.

To manually bind a control to an object:

  1. Drag a bindable control (not a container control) from any section of the Toolbox other than Selection and drop the control onto the form.
  2. With the control selected, in the upper right corner of the control you just added to the form, click the red and white arrow (alternatively, you can also edit the path in the control's Path property in the Property Editor—the Path property defines the member of the class to which the control is currently bound.
  3. In the menu that appears, to the right of Path: <not set>, click the ellipsis button [...].
  4. In the dialog box that appears, select the portion of the Model (class member) to which you want to bind the control.
  5. Click OK. This has the effect of implicitly assigning the same control adapter to both the control and the class member, thus enabling runtime binding. To "un-instantiate" a control adapter between the control and the class member, clear the class member path reference in the Path property (in the Property Editor); now the control is not bound to any element of the Model object structure. To restore the control adapter to an appropriate part of the class member, edit the Path property.

To delete a control from a form:

  1. In the Design Editor, select the control.
  2. Press Delete on your keyboard.

[edit] Error Handling

 

[edit] Examples

See the Hello Bungee Connect tutorial.

[edit] Next Steps

Simulating or Testing Your Project or Application

[edit] Tags


Log in if you would like to rate this page.
    Copyright © 2005 - 2007 Bungee Labs. All rights reserved.