Connecting the new Windows 10 Calendar Controls to data using the LiveBindings Designer

Posted by on in Data

Pawel recently did a great post on making the Windows 10 calendar controls database aware. I thought I would follow that up with a post on connecting the new Windows 10 VCL calendar controls to data using the LiveBindings Designer. 

In this post, I am going to connect TCalendarView to sample data and enable color changing of the calendar's background color using TColorBox. None of this involves any code as everything is set up using the LiveBindings Designer.

 

 

Step 1: Drop your controls onto the form

Place TCalendarView, TListView, TPrototypeBindSource and TColorBox onto your form. Right-click on TProtoTypeBindSource and select Add Field. Then select Datefield, FieldType ftDate to select sample data. Set TListView's IconOptions > WrapText to False.

 

Step 2: Add Bindable Members to TCalendarView

With the calendar control selected on your form, go to View > LiveBindings Designer. Click on ... to bring up all Bindable Members.   Select 'Color' and 'Date' and click OK.

 

Step 3: Set up your Bindings

Set up the bindings as shown below. As you can see in the screenshot below, both the ListView and CalendarView are connected to the PrototypeBindSource component. Connecting * to the Sync property ensure that the data is kept in sync. As you click on each date in the list control, the date shown on the calendar is automatically updated. 

 

Here's a quick video of the sample in action:

 

 

 



About
Gold User, Rank: 5, Points: 558
Senior Product Manager, RAD Studio

Comments

Check out more tips and tricks in this development video: