Cell Cell Class

Definition

Provides base class and capabilities for all Xamarin.Forms cells. Cells are elements meant to be added to ListView or TableView.

public abstract class Cell : Xamarin.Forms.Element, Xamarin.Forms.ICellController
type Cell = class
    inherit Element
    interface ICellController
    interface IFlowDirectionController
Inheritance
Derived
Implements

Remarks

The subtypes of Cell are:

Type Description
EntryCell A Cell with a label and a single line text entry field.
SwitchCell A Cell with a label and an on/off switch.
TextCell A Cell with primary and secondary text.
ImageCell A TextCell that also includes an image.
ViewCell A Cell containing a developer-defined View.

The various subclasses are shown in the following image:


Content = new TableView
{
    Root = new TableRoot ("Table Title")
    {
        new TableSection("Section 1 Title")
        {
            new TextCell
            {
                Text = "TextCell Text",
                Detail = "TextCell Detail"
            },
            new ImageCell
            {
                Text = "ImageCell Text",
                Detail = "ImageCell Detail",
                ImageSource = "http://xamarin.com/images/index/ide-xamarin-studio.png"
            },
            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:"
            },
            new ViewCell
            {
                View = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Children = 
                    {
                        new Label
                        {
                            Text = "Custom Slider View:"
                        },
                        new Slider
                        {
                        }
                    }
                }
            }
        }
    }
}          
          

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

Property Value
ContextActions

A list of MenuItem objects to display when the user performs the context action.

IsEnabled

true or false, indicating whether the animation for ActivityIndicator is displayed.

Constructors

Cell() Cell()

Initializes a new instance of the Cell class.

Fields

DefaultCellHeight DefaultCellHeight

The default height of cells.

IsEnabledProperty IsEnabledProperty

Identifies the IsEnabled bindable property.

Properties

AutomationId AutomationId

Gets or sets a value that allows the automation framework to find and interact with this element.

(Inherited from Element)
BindingContext BindingContext

Gets or sets object that contains the properties that will be targeted by the bound properties that belong to this BindableObject.

(Inherited from BindableObject)
ClassId ClassId

Gets or sets a value used to identify a collection of semantically similar elements.

(Inherited from Element)
ContextActions ContextActions

Gets a list of menu items to display when the user performs the device-specific context gesture on the Cell.

EffectControlProvider EffectControlProvider

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
Effects Effects

A list of the effects that are applied to this item.

(Inherited from Element)
HasContextActions HasContextActions

Gets a value that indicates whether the cell has at least one menu item in its ContextActions list property.

Height Height

Gets or sets the height of the Cell.

Id Id

Gets a value that can be used to uniquely identify an element through the run of an application.

(Inherited from Element)
IsEnabled IsEnabled

Gets or sets the IsEnabled state of the Cell. This is a bindable property.

LogicalChildren LogicalChildren

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
Parent Parent

Gets or sets the parent element of the element.

(Inherited from Element)
ParentView ParentView

Gets the element which is the closest ancestor of this element that is a VisualElement.

(Inherited from Element)
Platform Platform

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
RealParent RealParent

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
RenderHeight RenderHeight

Gets the height of the rendered cell on the device.

StyleId StyleId

Gets or sets a user defined value to uniquely identify the element.

(Inherited from Element)

Methods

ApplyBindings() ApplyBindings()

Apply the bindings to BindingContext.

(Inherited from BindableObject)
ClearValue(BindableProperty) ClearValue(BindableProperty)

Clears any value set by Xamarin.Forms.BindableObject.SetValue for property.

(Inherited from BindableObject)
ClearValue(BindablePropertyKey) ClearValue(BindablePropertyKey)

Clears any value set by Xamarin.Forms.BindableObject.SetValue for the property that is identified by propertyKey.

(Inherited from BindableObject)
Descendants() Descendants()

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
EffectIsAttached(String) EffectIsAttached(String)

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
ForceUpdateSize() ForceUpdateSize()

Immediately updates the cell's size.

GetValue(BindableProperty) GetValue(BindableProperty)

Returns the value that is contained the BindableProperty.

(Inherited from BindableObject)
GetValues(BindableProperty, BindableProperty) GetValues(BindableProperty, BindableProperty)

For internal use by the Xamarin.Forms platform.

(Inherited from BindableObject)
GetValues(BindableProperty, BindableProperty, BindableProperty) GetValues(BindableProperty, BindableProperty, BindableProperty)

For internal use by the Xamarin.Forms platform.

(Inherited from BindableObject)
IsSet(BindableProperty) IsSet(BindableProperty)

Returns true if the target property exists and has been set.

(Inherited from BindableObject)
OnAppearing() OnAppearing()

Invoked whenever an Appearing event occurs. Implement this method to add class handling for this event.

OnBindingContextChanged() OnBindingContextChanged()

Event that is raised when the binding context is changed.

OnChildAdded(Element) OnChildAdded(Element)

Invoked whenever the ChildAdded event needs to be emitted. Implement this method to add class handling for this event.

(Inherited from Element)
OnChildRemoved(Element) OnChildRemoved(Element)

Invoked whenever the ChildRemoved event needs to be emitted. Implement this method to add class handling for this event.

(Inherited from Element)
OnDisappearing() OnDisappearing()

Invoked whenever an Disappearing event occurs. Implement this method to add class handling for this event.

OnParentSet() OnParentSet()

Application developers can override this method to do actions when the cell's parent is set.

OnPropertyChanged(String) OnPropertyChanged(String)

Method that is called when a bound property is changed.

(Inherited from Element)
OnPropertyChanging(String) OnPropertyChanging(String)

TApplication developers can override this method to do actions when the property named by propertyName is set.

OnTapped() OnTapped()

Invoked whenever the Cell is Tapped.

RemoveBinding(BindableProperty) RemoveBinding(BindableProperty)

Removes a previously set binding.

(Inherited from BindableObject)
RemoveDynamicResource(BindableProperty) RemoveDynamicResource(BindableProperty)

Removes a previously set dynamic resource

(Inherited from Element)
SendAppearing() SendAppearing()

For internal use by the Xamarin.Forms platform.

SendDisappearing() SendDisappearing()

For internal use by the Xamarin.Forms platform.

SetBinding(BindableProperty, BindingBase) SetBinding(BindableProperty, BindingBase)

Assigns a binding to a property.

(Inherited from BindableObject)
SetDynamicResource(BindableProperty, String) SetDynamicResource(BindableProperty, String)

Sets the BindableProperty property of this element to be updated via the DynamicResource with the provided key.

(Inherited from Element)
SetValue(BindableProperty, Object) SetValue(BindableProperty, Object)

Sets the value of the specified property.

(Inherited from BindableObject)
SetValue(BindablePropertyKey, Object) SetValue(BindablePropertyKey, Object)

Sets the value of the propertyKey.

(Inherited from BindableObject)
SetValueCore(BindableProperty, Object, SetValueFlags) SetValueCore(BindableProperty, Object, SetValueFlags)

For internal use by the Xamarin.Forms platform.

(Inherited from BindableObject)
SetValueFromRenderer(BindableProperty, Object) SetValueFromRenderer(BindableProperty, Object)

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
SetValueFromRenderer(BindablePropertyKey, Object) SetValueFromRenderer(BindablePropertyKey, Object)

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
UnapplyBindings() UnapplyBindings()

Unapplies all previously set bindings.

(Inherited from BindableObject)

Events

Appearing Appearing

Occurs when the visual representation of the Cell is being added to the visual layout.

BindingContextChanged BindingContextChanged

Raised whenever the BindingContext property changes.

(Inherited from BindableObject)
ChildAdded ChildAdded

Occurs whenever a child element is added to the element.

(Inherited from Element)
ChildRemoved ChildRemoved

Occurs whenever a child element is removed from the element.

(Inherited from Element)
DescendantAdded DescendantAdded

Occurs whenever a child element is added to the elements subtree.

(Inherited from Element)
DescendantRemoved DescendantRemoved

Occurs whenever a child element is removed from the elements subtree.

(Inherited from Element)
Disappearing Disappearing

Occurs when the visual representation of the Cell is being removed from the visual layout.

ForceUpdateSizeRequested ForceUpdateSizeRequested

For internal use by the Xamarin.Forms platform.

PlatformSet PlatformSet

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
PropertyChanged PropertyChanged

Raised when a property has changed.

(Inherited from BindableObject)
PropertyChanging PropertyChanging

Raised when a property is about to change.

(Inherited from BindableObject)
Tapped Tapped

Occurs when the Cell is Tapped.

Explicit Interface Implementations

IDynamicResourceHandler.SetDynamicResource(BindableProperty, String) IDynamicResourceHandler.SetDynamicResource(BindableProperty, String)

For internal use by the Xamarin.Forms platform.

(Inherited from BindableObject)
IElementController.SetValueFromRenderer(BindableProperty, Object) IElementController.SetValueFromRenderer(BindableProperty, Object)

For internal use by the Xamarin.Forms platform.

(Inherited from Element)
INameScope.FindByName(String) INameScope.FindByName(String)

For internal use only.

(Inherited from Element)
INameScope.RegisterName(String, Object) INameScope.RegisterName(String, Object)

For internal use only.

(Inherited from Element)
INameScope.RegisterName(String, Object, IXmlLineInfo) INameScope.RegisterName(String, Object, IXmlLineInfo)

For internal use only.

(Inherited from Element)
INameScope.UnregisterName(String) INameScope.UnregisterName(String)

For internal use only.

(Inherited from Element)

Extension Methods

SetBinding(BindableObject, BindableProperty, String, BindingMode, IValueConverter, String) SetBinding(BindableObject, BindableProperty, String, BindingMode, IValueConverter, String)

Creates and applies a binding to a property.

SetBinding<TSource>(BindableObject, BindableProperty, Expression<Func<TSource,Object>>, BindingMode, IValueConverter, String) SetBinding<TSource>(BindableObject, BindableProperty, Expression<Func<TSource,Object>>, BindingMode, IValueConverter, String)

Creates and applies a binding from an expression.

GetGroup<TView,TItem>(TItem) GetGroup<TView,TItem>(TItem)

For internal use by platform renderers.

GetGroupHeaderContent<TView,TItem>(TItem) GetGroupHeaderContent<TView,TItem>(TItem)

For internal use by platform renderers.

GetIndex<TView,TItem>(TItem) GetIndex<TView,TItem>(TItem)

For internal use by platform renderers.

GetIsGroupHeader<TView,TItem>(TItem) GetIsGroupHeader<TView,TItem>(TItem)

For internal use by platform renderers.

GetPath(Cell) GetPath(Cell)

For internal use by platform renderers.

SetIsGroupHeader<TView,TItem>(TItem, Boolean) SetIsGroupHeader<TView,TItem>(TItem, Boolean)

For internal use by platform renderers.

FindByName<T>(Element, String) FindByName<T>(Element, String)

Returns the instance of type T that has name name in the scope that includes element.

LoadFromXaml<TXaml>(TXaml, String) LoadFromXaml<TXaml>(TXaml, String)

Returns an initialized view by loading the specified xaml.

LoadFromXaml<TXaml>(TXaml, Type) LoadFromXaml<TXaml>(TXaml, Type)

Returns a TXaml with the properties that are defined in the application manifest for callingType.

Applies to