Xamarin.Forms Guides | Samples

Xamarin.Forms.TableView Class

A View that holds rows of Cell elements.

See Also: TableView

Syntax

[Xamarin.Forms.ContentProperty("Root")]
[Xamarin.Forms.RenderWith(typeof(Xamarin.Forms.Platform._TableViewRenderer))]
public class TableView : View, IElementConfiguration<TableView>, ITableViewController

Remarks

A TableView has a TableRoot as its TableView.Root property. The TableRoot is a type of TableSection.

The following example shows a basic table with two sections.

C# Example

public class App : Application
{
    public App()
    {
        MainPage = new ContentPage {
            Content = new TableView {
                Intent = TableIntent.Form,
                Root = new TableRoot ("Table Title") {
                    new TableSection ("Section 1 Title") {
                        new TextCell {
                            Text = "TextCell Text",
                            Detail = "TextCell Detail"
                        },
                        new EntryCell {
                            Label = "EntryCell:",
                            Placeholder = "default keyboard",
                            Keyboard = Keyboard.Default
                        }
                    },
                    new TableSection ("Section 2 Title") {
                        new EntryCell {
                            Label = "Another EntryCell:",
                            Placeholder = "phone keyboard",
                            Keyboard = Keyboard.Telephone
                        },
                        new SwitchCell {
                            Text = "SwitchCell:"
                        }
                    }
                }
            }
        }; 
    }
    // OnStart, OnSleep, OnResume overrides omitted...
}

XAML for Xamarin.Forms supports the following properties for the TableView class:

PropertyValue
HasUnevenRows

true or false, to indicate whether rows in the table view will specify their own height.

Intent

Data, Form, Menu, or Settings.

RowHeight

Horizontal or Vertical, to indicate the scroll direction.

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0

The members of Xamarin.Forms.TableView are listed below.

See Also: View

Public Constructors

Initializes a new TableView instance.
Initializes a new TableView instance.

Public Fields

static readonly
HasUnevenRowsPropertyBindableProperty. Backing store for the HasUnevenRows property.
static readonly
RowHeightPropertyBindableProperty. Backing store for the row height property.

Public Properties

HasUnevenRowsBoolean. Gets or sets a value that indicates whether the rows that are contained in this TableView can have uneven rows.
IntentTableIntent. Gets or sets the intent of the table.
RootTableRoot. Gets or sets the root of the table.
RowHeightInt32. An integer that describes the height of the items in the list. This is ignored if HasUnevenRows is true.

Public Methods

Protected Methods

override
OnBindingContextChanged()
Method that is called when the binding context changes.
OnModelChanged()
Method that is called when the model changes.
override
OnSizeRequest(Double, Double) : SizeRequest
Method that is called when a size request is made.

Explicitly Implemented Interface Members