Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiFiremonkeyIOSOSXWindows

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.

close

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

Related posts
AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

DelphiIDEShowcaseWindows

Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores

DelphiFiremonkeyIDEIOSOSXWindows

DelphiCon 2020 FireMonkey Sessions Available Starting November 19

AndroidC++BuilderDelphiDemoFiremonkeyWindows

Powerful Commercial Gorilla3D Framework Upgraded For Delphi FireMonkey On Windows And Android

Sign up for our Newsletter and
stay informed

Leave a Reply