Customize And Sort TListView LiveBindings Data With Firemonkey On Android And IOS

Delphi XE5 Firemonkey ListView LiveBindings Sort TutorialSarina DuPont from Embarcadero has a new tutorial up which demonstrates how to customize your TListViews when using LiveBindings in Delphi XE5 Firemonkey (and AppMethod specifically). Specifically the blog post talks about how to add headers to your TListViews, how to sort the data, and how to add a prefix to each data item in the TListView. This tutorial applies to Delphi XE6 Firemonkey as well and it should run cross platform on Android, IOS, Windows, and OSX. For adding the headers she bound the property from the data called ColorsName onto both the header and the items (ItemHeader.Text and Item.Text respectively). Then she used the FillHeaderCustomFormat property to customize what appears in the header field and used the following code to just get the first letter: SubString(%s, 0, 1). She also changed a property on ColorsName so that it will not repeat and will not shuffle the data. The trick for sorting data appears to be to change the IndexFieldNames property so that it contains the name of the field that you want to sort alphabetically. Lastly in order to apply a prefix the the data you’ll want to add the following code to the FillDisplayCustomFormat property: “My Prefix ” + UpperCase(%s) which will add the words ‘My Prefix ‘ before each item in the TListView. It looks like it can be kind of tricky to get the LiveBindings data in a TListView set up the way you want but once you learn how it works it could really speed up development.

Head over and check out the full blog post plus screen shots on how to sort and customize TListView LiveBindings data.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Topple The Tower Box2d Game Source Code For Delphi XE6 Firemonkey On Windows

I have polished up a new Box2D Firemonkey game demo prototype with full source code for Delphi XE5 and XE6 Firemonkey...

Close