Cell 類別

定義

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

public abstract class Cell : Xamarin.Forms.Element, Xamarin.Forms.ICellController
type Cell = class
    inherit Element
    interface ICellController
繼承
衍生
實作

備註

Cell 子類型如下:

類型描述
EntryCell具有標籤和一行文字項目欄位的 Cell
SwitchCell具有標籤與開啟/關閉參數的 Cell
TextCellCell具有主要和次要文字的 。
ImageCellTextCell也包含影像的 。
ViewCell包含開發人員定義 ViewCell

下圖顯示各種子類別:

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
                        {
                        }
                    }
                }
            }
        }
    }
}          

建構函式

Cell()

初始化 Cell 類別的新執行個體。

欄位

DefaultCellHeight

儲存格的預設高度。

IsEnabledProperty

識別 IsEnabled 可繫結屬性。

屬性

AutomationId

取得或設定值,允許自動化架構尋找此項目並與之互動。

(繼承來源 Element)
BindingContext

取得或設定物件,這個物件包含屬於此 BindableObject 屬性繫結屬性將設為目標的屬性。

(繼承來源 BindableObject)
ClassId

取得或設定值,用來識別語意類似項目的集合。

(繼承來源 Element)
ContextActions

取得當使用者在儲存格上執行裝置特定內容動作時,要顯示的功能表項目清單。

Dispatcher

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

(繼承來源 BindableObject)
EffectControlProvider

供 Xamarin.Forms 平台內部使用。

(繼承來源 Element)
Effects

套用至此項目的效果清單。

(繼承來源 Element)
HasContextActions

取得值,這個值表示儲存格在其 ContextActions 清單屬性中是否至少有一個功能表項目。

Height

取得或設定儲存格的高度。

Id

取得值,可用來在應用程式執行期間唯一識別項目。

(繼承來源 Element)
IsContextActionsLegacyModeEnabled

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

IsEnabled

取得或設定儲存格的 IsEnabled 狀態。 這是可繫結屬性。

LogicalChildren

供 Xamarin.Forms 平台內部使用。

(繼承來源 Element)
Parent

取得或設定項目的父項目。

(繼承來源 Element)
ParentView
已過時。

取得即此項目最接近上階的項目,而此項目是 VisualElement

(繼承來源 Element)
Platform
已過時。

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

(繼承來源 Element)
RealParent

供 Xamarin.Forms 平台內部使用。

(繼承來源 Element)
RenderHeight

取得裝置上所呈現儲存格的高度。

StyleId

取得或設定使用者定義值來唯一識別項目。

(繼承來源 Element)

方法

ApplyBindings()

將繫結套用至 BindingContext

(繼承來源 BindableObject)
ClearValue(BindableProperty)

清除 SetValue 針對 property 所設定的任何值。

(繼承來源 BindableObject)
ClearValue(BindablePropertyKey)

清除 SetValue 針對 propertyKey 所識別屬性設定的任何值。

(繼承來源 BindableObject)
CoerceValue(BindableProperty)

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

(繼承來源 BindableObject)
CoerceValue(BindablePropertyKey)

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

(繼承來源 BindableObject)
Descendants()

供 Xamarin.Forms 平台內部使用。

(繼承來源 Element)
EffectIsAttached(String)

供 Xamarin.Forms 平台內部使用。

(繼承來源 Element)
FindByName(String)

傳回具有指定名稱的元素。

(繼承來源 Element)
ForceUpdateSize()

立即更新儲存格的大小。

GetValue(BindableProperty)

傳回 BindableProperty 中包含的值。

(繼承來源 BindableObject)
GetValues(BindableProperty, BindableProperty)
已過時。

供 Xamarin.Forms 平台內部使用。

(繼承來源 BindableObject)
GetValues(BindableProperty, BindableProperty, BindableProperty)
已過時。

供 Xamarin.Forms 平台內部使用。

(繼承來源 BindableObject)
IsSet(BindableProperty)

如果目標屬性存在且已設定,則傳回 true

(繼承來源 BindableObject)
On<T>()

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

OnAppearing()

每當 Appearing 事件發生時便會叫用。 實作這個方法可為此事件加入類別處理。

OnBindingContextChanged()

繫結內容變更時引發的事件。

OnChildAdded(Element)

只要需要發出 ChildAdded 事件時即叫用。 實作這個方法可為此事件加入類別處理。

(繼承來源 Element)
OnChildRemoved(Element)
已過時。

只要需要發出 ChildRemoved 事件時即叫用。 實作這個方法可為此事件加入類別處理。

(繼承來源 Element)
OnChildRemoved(Element, Int32)

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

(繼承來源 Element)
OnDisappearing()

每當 Disappearing 事件發生時便會叫用。 實作這個方法可為此事件加入類別處理。

OnParentSet()

應用程式開發人員可以覆寫這個方法,以便在設定儲存格的父代時執行動作。

OnPropertyChanged(String)

繫結屬性變更時呼叫的方法。

(繼承來源 Element)
OnPropertyChanging(String)

應用程式開發人員可以覆寫這個方法,以便在設定由 propertyName 命名的屬性時執行動作。

OnTapped()

每當點選儲存格時便會叫用。

RemoveBinding(BindableProperty)

移除先前設定的繫結。

(繼承來源 BindableObject)
RemoveDynamicResource(BindableProperty)

移除先前設定的動態資源

(繼承來源 Element)
SendAppearing()

供 Xamarin.Forms 平台內部使用。

SendDisappearing()

供 Xamarin.Forms 平台內部使用。

SetBinding(BindableProperty, BindingBase)

將繫結指派給屬性。

(繼承來源 BindableObject)
SetDynamicResource(BindableProperty, String)

透過具有所提供索引鍵的 DynamicResource,設定更新此項目的 BindableProperty 屬性。

(繼承來源 Element)
SetValue(BindableProperty, Object)

設定指定之屬性的值。

(繼承來源 BindableObject)
SetValue(BindablePropertyKey, Object)

設定 propertyKey 的值。

(繼承來源 BindableObject)
SetValueCore(BindableProperty, Object, SetValueFlags)

供 Xamarin.Forms 平台內部使用。

(繼承來源 BindableObject)
SetValueFromRenderer(BindableProperty, Object)

供 Xamarin.Forms 平台內部使用。

(繼承來源 Element)
SetValueFromRenderer(BindablePropertyKey, Object)

供 Xamarin.Forms 平台內部使用。

(繼承來源 Element)
UnapplyBindings()

取消套用所有先前設定的繫結。

(繼承來源 BindableObject)

事件

Appearing

將儲存格的視覺表示方式新增至視覺化配置時發生。

BindingContextChanged

每當 BindingContext 屬性變更時引發。

(繼承來源 BindableObject)
ChildAdded

只要將子項目新增至項目時就發生。

(繼承來源 Element)
ChildRemoved

只要從項目移除子項目時就發生。

(繼承來源 Element)
DescendantAdded

只要將子項目新增至項目樹狀子目錄時即發生。

(繼承來源 Element)
DescendantRemoved

只要從項目樹狀子目錄移除子項目時即發生。

(繼承來源 Element)
Disappearing

從視覺化配置中移除儲存格的視覺表示方式時發生。

ForceUpdateSizeRequested

供 Xamarin.Forms 平台內部使用。

PlatformSet
已過時。

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

(繼承來源 Element)
PropertyChanged

在屬性變更時引發。

(繼承來源 BindableObject)
PropertyChanging

在屬性即將變更時引發。

(繼承來源 BindableObject)
Tapped

在點選儲存格時發生。

明確介面實作

IDynamicResourceHandler.SetDynamicResource(BindableProperty, String)

供 Xamarin.Forms 平台內部使用。

(繼承來源 BindableObject)
IElementController.SetValueFromRenderer(BindableProperty, Object)

供 Xamarin.Forms 平台內部使用。

(繼承來源 Element)
INameScope.RegisterName(String, Object)

僅供內部使用。

(繼承來源 Element)

擴充方法

GetPropertyIfSet<T>(BindableObject, BindableProperty, T)

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

SetAppThemeColor(BindableObject, BindableProperty, Color, Color)

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

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

建立並將繫結套用至屬性。

SetBinding<TSource>(BindableObject, BindableProperty, Expression<Func<TSource,Object>>, BindingMode, IValueConverter, String)
已過時。

從運算式建立及套用繫結。

SetOnAppTheme<T>(BindableObject, BindableProperty, T, T)

提供所有 Xamarin.Forms 儲存格的基底類別和功能。 儲存格都是要新增至 ListViewTableView 的項目。

GetPath(Cell)

供平台轉譯器內部使用。

FindByName<T>(Element, String)

傳回包含 element 的範圍中具有 name 名稱的 T 類型執行個體。

適用於