FMX.ListViewCustomBottomDetail Sample

From RAD Studio Code Examples
Jump to: navigation, search

This is a project that shows how to customize the appearance of a TListView to show a detail text at the bottom of every list view item. It does this by using the "Custom" list view item appearance value and configuring the appearance properties of list view items at design time. It also shows how to do this at run time.


You can find the ListViewCustomBottomDetail Sample sample project at:

  • Start | Programs | Embarcadero RAD Studio Alexandria | Samples and navigate to:
    • Object Pascal\Multi-Device Samples\User Interface\ListView\ListViewCustomBottomDetail
    • CPP\Multi-Device Samples\User Interface\ListView\ListViewCustomBottomDetail
  • Subversion Repository:
    • You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.


When you run the application, it shows a list view. Each list item shows a detail text under its main label.

Tap the Set Properties button to change the appearance of the list view at run time. Tap the ToggleEditMode button to have the list view enter a selection edit mode where you can select several items. The buttons at the bottom, LiveBindings and Fill in Code, let you fill the list view with items defined using LiveBindings or defined at run time, respectively.

How to Use the Sample

  1. Navigate to the one of the locations given above, and open:
    • Delphi: SampleListViewCustomBottomDetailProject.dproj
    • C++: SampleListViewCustomBottomDetailProject.cbproj
  2. Press F9 or choose Run > Run.


The values of the ItemAppearance.ItemAppearance and ItemAppearance.ItemEditAppearance properties of the list view in this application are "Custom". This indicates that, instead of using a default appearance set, the appearance objects of the item appearance are customized. They have been customized at design time, selecting appearance objects in the Structure view and changing their properties from the Object Inspector.

By default, the base custom appearance only has one visible appearance object: Text. That is, Text is the only visible appearance object in TListView.ItemAppearance.Item and TListView.ItemAppearance.ItemEdit. This application makes visible the following appearance objects as well, and configures their properties to customize their appearance:

In addition to these design time changes, this application handles the OnUpdateObjects event of the list view to adjust the width of the Text and Detail appearance objects.

The Set Properties button, when tapped, modifies the appearance of the list view at run time, performing appearance adjustment on top of the custom appearance defined at design time.

The LiveBindings button uses TLinkFillControlToField to fill the list view using LiveBindings. The Fill in Code button uses a for loop to fill the list view with items created at run time.


See Also