FMX.ListViewMultiDetailAppearance 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 three detail text items. It does this by using list view item appearances previously defined in a custom package.


You can find the ListViewMultiDetailAppearance Sample sample project at:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and navigate to:
    • Object Pascal\Multi-Device Samples\User Interface\ListView\ListViewMultiDetailAppearance
  • Subversion Repository:
    • You can find Delphi 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 three different detail fields under their main label.

You can 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 location given above and open the package file SampleListViewMultiDetailAppearancePackage.dpk.
  2. In the Project Manager, right-click the SampleListViewMultiDetailAppearancePackage.bpl file and select Install from the context menu.
  3. Return to the location given above and open the project file ListViewMultiDetailAppearanceProject.dproj.
  4. Double-click the project entry on the Project Manager, and press F9 or choose Run > Run.


The package defines three subclasses of Appearances.TPresetItemObjects that implement a custom appearance for list view items. It actually defines a base subclass that is later inherited and extended by the other two subclasses.

These subclasses use instances of Appearances.TTextObjectAppearance to implement the three detail fields that each list item shows. The rest of the fields are inherited from Appearances.TPresetItemObjects and customized as necessary.

The application uses these subclasses in the ItemAppearance.ItemAppearance and ItemAppearance.ItemEditAppearance properties of the list view to use the appearance defined in the installed package. You can tap ToggleEditMode to see how the application keeps the appearance in edit mode.

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