How To : Binding a Control to an Object
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:
- In the Solution Explorer or Solution Detail, select the class member to which you want the control to be bound.
- 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:
- Drag a bindable control (not a container control) from any section of the Toolbox other than Selection and drop the control onto the form.
- 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.
- In the menu that appears, to the right of Path: <not set>, click the ellipsis button [...].
- In the dialog box that appears, select the portion of the Model (class member) to which you want to bind the control.
- 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:
- In the Design Editor, select the control.
- 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
Categories: HOW TO | Forms | Controls