Linking a Control with a Component Property

From RAD Studio
Jump to: navigation, search

Go Up to LiveBindings Wizard


This procedure shows you how to link a control with a component property, using the LiveBindings Wizard.

First create an HD Multi-Device Application, then place a progress bar and a track bar on the form. You will learn how to bind the track bar control to the Value property of the progress bar control.

LBTProgressTrack.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. If you start the wizard from the LiveBindings Designer, then there is no need to enable it from the options dialog box.

Step 1: Binding Task

After placing the progress bar and the track bar on the form, you need to bind them together.

Right-click the track bar and select the LiveBindings Wizard command.

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

LBTLinkControlWithProperty1.png

Validate your selection by clicking Next.

Step 2: Component Property

Now you are prompted to select the component and property to which you want to bind your track bar.

In the Component combo box, select ProgressBar1.

In the Property combo box, select Value.

LBTLinkControlWithProperty2.png

Validate your selection by clicking Finish. A new binding expression is created that binds the Value property of the track bar and the progress bar.

The Results

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

LBTLinkControlWithPropertyBindingsList.png

Now run the application (press F9) and test your binding expression by moving the slider of the track bar. You should see that the progress bar updates correctly.

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

LBTLinkControlWithPropertyResults.png

See Also