ImageCell 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
包含图像的 TextCell。
public class ImageCell : Xamarin.Forms.TextCell
type ImageCell = class
inherit TextCell
- 继承
注解
ImageCell对象用于将图像和伴随的文本放入表中。
以下示例演示了基本用法。
using System;
using Xamarin.Forms;
namespace FormsGallery
{
class ImageCellDemoPage : ContentPage
{
public ImageCellDemoPage()
{
Label header = new Label
{
Text = "ImageCell",
FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
HorizontalOptions = LayoutOptions.Center
};
TableView tableView = new TableView
{
Intent = TableIntent.Form,
Root = new TableRoot
{
new TableSection
{
new ImageCell
{
// Some differences with loading images in initial release.
ImageSource =
Device.OnPlatform(ImageSource.FromUri(new Uri("http://xamarin.com/images/index/ide-xamarin-studio.png")),
ImageSource.FromFile("ide_xamarin_studio.png"),
ImageSource.FromFile("Images/ide-xamarin-studio.png")),
Text = "This is an ImageCell",
Detail = "This is some detail text",
}
}
}
};
// Accomodate iPhone status bar.
this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
// Build the page.
this.Content = new StackLayout
{
Children =
{
header,
tableView
}
};
}
}
}

构造函数
| ImageCell() |
初始化 ImageCell 类的新实例。 |
字段
| DefaultCellHeight |
单元的默认高度。 (继承自 Cell) |
| ImageSourceProperty |
标识 ImageSource 可绑定属性。 |
属性
| AutomationId |
获取或设置允许自动化框架查找此元素并与其交互的值。 (继承自 Element) |
| BindingContext |
获取或设置对象,该对象包含将被属于此 BindableObject 的绑定属性设定为目标的属性。 (继承自 BindableObject) |
| ClassId |
获取或设置用于标识语义相似元素集合的值。 (继承自 Element) |
| Command |
获取或设置要在点击 TextCell 时执行的 ICommand。 这是一种可绑定属性。 (继承自 TextCell) |
| CommandParameter |
获取或设置在调用该命令时要传递的参数。 这是一种可绑定属性。 (继承自 TextCell) |
| ContextActions |
获取当用户在 Cell 上执行特定于设备的上下文手势时要显示的菜单项列表。 (继承自 Cell) |
| Detail |
获取或设置 TextCell 中要显示的辅助文本。 这是一种可绑定属性。 (继承自 TextCell) |
| DetailColor |
获取或设置辅助文本的呈现颜色。 这是一种可绑定属性。 (继承自 TextCell) |
| Dispatcher |
包含图像的 TextCell。 (继承自 BindableObject) |
| EffectControlProvider |
供 Xamarin.Forms 平台内部使用。 (继承自 Element) |
| Effects |
应用于此项的效果列表。 (继承自 Element) |
| HasContextActions |
获取一个值,该值指示单元在其 ContextActions 列表属性中是否至少具有一个菜单项。 (继承自 Cell) |
| Height |
获取或设置 Cell 的高度。 (继承自 Cell) |
| Id |
获取可用于通过运行应用程序唯一地标识元素的值。 (继承自 Element) |
| ImageSource |
获取或设置要从中加载图像的 ImageSource。 这是一种可绑定属性。 |
| IsContextActionsLegacyModeEnabled |
包含图像的 TextCell。 (继承自 Cell) |
| IsEnabled |
获取或设置 Cell 的 IsEnabled 状态。 这是一种可绑定属性。 (继承自 Cell) |
| LogicalChildren |
供 Xamarin.Forms 平台内部使用。 (继承自 Element) |
| Parent |
获取或设置元素的父元素。 (继承自 Element) |
| ParentView |
已过时.
获取作为 VisualElement 的此元素的最近的上级元素。 (继承自 Element) |
| Platform |
已过时.
包含图像的 TextCell。 (继承自 Element) |
| RealParent |
供 Xamarin.Forms 平台内部使用。 (继承自 Element) |
| RenderHeight |
获取设备上呈现的单元的高度。 (继承自 Cell) |
| StyleId |
获取或设置用于唯一地标识元素的用户定义的值。 (继承自 Element) |
| Text |
获取或设置要显示的主要文本。 这是一种可绑定属性。 (继承自 TextCell) |
| TextColor |
获取或设置主要文本的呈现颜色。 这是一种可绑定属性。 (继承自 TextCell) |
方法
事件
| Appearing |
将 Cell 的视觉对象表示形式添加到视觉对象布局时发生。 (继承自 Cell) |
| BindingContextChanged |
只要 BindingContext 属性更改就会引发。 (继承自 BindableObject) |
| ChildAdded |
每当将子元素添加到元素时就会发生。 (继承自 Element) |
| ChildRemoved |
每当从元素中删除子元素时就会发生。 (继承自 Element) |
| DescendantAdded |
每当将子元素添加到元素子树时就会发生。 (继承自 Element) |
| DescendantRemoved |
每当从元素子树中删除子元素时就会发生。 (继承自 Element) |
| Disappearing |
将 Cell 的视觉对象表示形式从视觉对象布局删除时发生。 (继承自 Cell) |
| ForceUpdateSizeRequested |
供 Xamarin.Forms 平台内部使用。 (继承自 Cell) |
| PlatformSet |
已过时.
包含图像的 TextCell。 (继承自 Element) |
| PropertyChanged |
在属性已更改时引发。 (继承自 BindableObject) |
| PropertyChanging |
在属性将要更改时引发。 (继承自 BindableObject) |
| Tapped |
点击 Cell 时发生。 (继承自 Cell) |
显式接口实现
| IDynamicResourceHandler.SetDynamicResource(BindableProperty, String) |
供 Xamarin.Forms 平台内部使用。 (继承自 BindableObject) |
| IElementController.SetValueFromRenderer(BindableProperty, Object) |
供 Xamarin.Forms 平台内部使用。 (继承自 Element) |
| INameScope.RegisterName(String, Object) |
仅限内部使用。 (继承自 Element) |