Xamarin. Forms 控件类层次结构Xamarin.Forms Controls Class Hierarchy

Xamarin 是通过多个命名空间由数百个类型组成的。Xamarin.Forms is made up of hundreds of types, over multiple namespaces. 开发人员应最熟悉用于创建 Xamarin 窗体应用程序(位于 Xamarin.Forms 命名空间中)的用户界面的类型的层次结构。Developers should be most familiar with the hierarchy of types used to create the user interface of a Xamarin.Forms application, which reside in the Xamarin.Forms namespace.

这些类型可以划分为页、布局、视图和单元格。These types can be divided into pages, layouts, views, and cells. Xamarin 页面通常占用整个屏幕,所有页面类型都派生自Page类。A Xamarin.Forms page generally occupies the entire screen, and all the page types derive from the Page class. 页面通常包含布局,所有布局类型都派生自Layout类。Pages usually contain a layout, and all the layout types derive from the Layout class. 布局通常包含视图和其他布局,并且所有视图类型都派生自View类。A layout usually contains views and possibly other layouts, and all the view types derive from the View class. 最后,单元是在TableViewListView控件的显示数据中使用的专用控件。Finally, cells are specialized controls that are used in display data in the TableView and ListView controls. 页面、布局、视图和单元均最终派生自Element类。Pages, layouts, views, and cells are all ultimately derived from the Element class.

下面的类图显示了通常用于在 Xamarin 中生成用户界面的类型的层次结构:The following class diagram shows the hierarchy of types that are typically used to build a user interface in Xamarin.Forms:

Xamarin. 窗体控件类图Xamarin.Forms Controls Class Diagram


可从此处下载类图的高分辨率版本。A high resolution version of the class diagram can be downloaded from here. 但请注意,该关系图当前不显示 CarouselViewCollectionView 类型。However, note that the diagram does not currently show the CarouselView and CollectionView types. 这些控件将在控件退出预览后添加。These will be added once the controls are out of preview. 此外,关系图只显示一种 Shell 类型。In addition, the diagram only shows a single Shell type.