FMX.ListView.TListView

From RAD Studio API Documentation
Jump to: navigation, search

FMX.ListView.TCustomListViewFMX.ListView.TAppearanceListViewFMX.ListView.TPresentedListViewFMX.ListView.TListViewBaseFMX.ListView.TAdapterListViewFMX.Controls.TStyledControlTListView

Delphi

TListView = class(TCustomListView)

C++

class PASCALIMPLEMENTATION TListView : public TCustomListView

Properties

Type Visibility Source Unit Parent
class public
FMX.ListView.pas
FMX.ListView.hpp
FMX.ListView FMX.ListView

Description

Represents a FireMonkey list view component that you can use to hold and present various types of items.

The TListView displays a collection of items in a list that is optimized for LiveBindings and for fast and smooth scrolling.

The items in the list view can have one or more of the following appearance features:

  • A caption or detail text (for example, using the Item.Text bindable member of TListView)
  • An associated image (for example, using the Item.Bitmap bindable member of TListView)
  • An accessory icon (for example, using the ItemEditAppearance property in the Object Inspector)
  • A graphic or a text button attached (for example, using the Item.ButtonText bindable member of TListView)

You can customize the appearance of a list view by modifying the layout of the list items, including the caption, the associated image, text details, or the accessory icon.

TListView has the edit mode in which you can select several items.

Example

You can add items to a TListView either by binding to a data source, or by code (TListView.Items.Add).

Here is a code example that shows how to add items to a TListView:

Delphi:

var
  LItem: TListViewItem;
  I: Integer;
begin
  for I := 1 to 10 do
  begin
    LItem := ListView1.Items.Add;
    LItem.Text := IntToStr(I); 
 end;
end;

// To achieve the best performance use BeginUpdate and EndUpdate.

var
  LItem: TListViewItem;
  I: Integer;
begin
  ListView1.BeginUpdate;
  try
    for I := 1 to 10 do
    begin
      LItem := ListView1.Items.Add;
      LItem.Text := IntToStr(I);
    end;
  finally
    ListView1.EndUpdate;
  end;
end;

C++:

for (int i = 1; i <= 10; i++) {
  TListViewItem* item = ListView1->Items->Add();
  item->Text = IntToStr(i);
}

// To achieve the best performance use BeginUpdate and EndUpdate.

ListView1->BeginUpdate();
try {
  for (int i = 1; i <= 10; i++) {
    TListViewItem* item = ListView1->Items->Add();
    item->Text = IntToStr(i);
  }
} catch (...) {
}
ListView1->EndUpdate();

See Also

Samples