Linking a Property of a Component with a Control

From RAD Studio
Jump to: navigation, search

Go Up to LiveBindings Wizard


This procedure shows you how to link a property of a component with a control by means of the LiveBindings Wizard.

Create an HD Multi-Device Application, and then place a label and an edit box on the form. You will learn how to bind the Text property of the label to the edit box control.

LBTLabelEdit.png

Tip: In order for the LiveBindings Wizard to be available in the right-click context menu, you need to enable it in Tools > Options > LiveBindings by selecting "Display LiveBindings Wizard in right-click menu". (If you start the wizard from the LiveBindings Designer, then you do not need to enable the wizard command in the options dialog box.)

Step 1: Binding Task

After placing the label and the edit box, you need to bind the label to the edit.

Right-click the label and select the LiveBindings Wizard command.

Then select Link a property of component "Label1" with a control from the Binding Task wizard page.

LBTLinkPropertyWithControl1.png

Click Next.

Step 2: Component Property

Now you can see that your component is selected as Label1 in the combo box. You could change your selection to another component, but that is not the purpose of this procedure.

In the Property combo box, select Text so that the text of the label is affected when you enter some text in the edit box.

Click Next.

LBTLinkPropertyWithControl2.png

Step 3: Control

Now you are prompted to select an existing control, or you have the option to create a new control to which to bind the Text property of your label. From the Existing Control tab, select Edit1 in the list.

LBTLinkPropertyWithControl3.png

Click Finish.

The Results

After the wizard closes and you are returned to the design mode in the IDE, you can see that a new TBindingsList component was added to the form. To bring up the Binding Expression Editor dialog box, double-click the BindingsList1 component.

LBTBindingsList.png

Now run the application (press F9) and test your binding expression by entering some text in the edit box, and then pressing the Enter key.

A screenshot of the running application is presented in the following picture.

LBTLinkPropertyWithControlResults.png

See Also