Xamarin.Forms 使用者介面檢視Xamarin.Forms User Interface Views

下載範例下載範例Download Sample Download the sample

如何使用 Xamarin.Forms 所提供的檢視How to use the views provided by Xamarin.Forms


Xamarin.Forms 包含自己的動畫基礎結構直接建立簡單的動畫,同時也很多方面足敷建立複雜的動畫。Xamarin.Forms includes its own animation infrastructure that's straightforward for creating simple animations, while also being versatile enough to create complex animations.


BoxView只是簡單彩色矩形,但是它可以用為裝飾性項目、 基本圖形,以及取得互動式的觸控輸入。The BoxView is just a simple colored rectangle, but it can be used for decorative items, rudimentary graphics, and for obtaining interative touch input.


Button回應點選或按一下,以指示應用程式執行特定工作。The Button responds to a tap or click that directs an application to carry out a particular task.


CollectionView 是一種有彈性且高效能的檢視,來呈現資料使用不同的版面配置規格的清單。The CollectionView is a flexible and performant view for presenting lists of data using different layout specifications.


定義和跨平台使用色彩可能很難時每個平台有它自己的標準和預設值。Defining and using colors across platforms can be tricky when each platform has its own standards and defaults.

控制項參考Controls Reference

這份文件會構成 Xamarin.Forms 架構,例如 [檢視] 的快速參考版面配置檢視資料格.This document is a quick reference to the UI views that make up the Xamarin.Forms framework, such as Pages, Layouts, Views and Cells.


DataPages 提供 API,以快速且輕鬆地繫結資料來源至預先建立的檢視。DataPages provide an API to quickly and easily bind a data source to pre-built views. 清單項目和詳細資料頁面會自動轉譯資料,並使用佈景主題來自訂。List items and detail pages will automatically render the data, and be customized using themes.


DatePicker可讓使用者選取日期,以指定的範圍內。The DatePicker allows a user to select a date within a specified range. 它是使用特定的平台上執行應用程式所支援的日期選擇器所實作的。It is implemented using the date picker supported by the particular platform that the application is run on.

使用 Skiasharp 的圖形Graphics with SkiaSharp

如何將圖形加入使用 SkiaSharp 的 Xamarin.Forms 應用程式。How to incorporate graphics into a Xamarin.Forms application using SkiaSharp.


圖像可以跨平台與 Xamarin.Forms 共用、 可以載入特別針對每個平台,或它們可以供下載顯示。Images can be shared across platforms with Xamarin.Forms, they can be loaded specifically for each platform, or they can be downloaded for display.


ImageButton顯示影像,並回應點選或按一下,以指示應用程式執行特定工作。The ImageButton displays an image and responds to a tap or click that directs an application to carry out a particular task.


Xamarin.Forms 會有數個版面配置組織螢幕上的內容。Xamarin.Forms has several layouts for organizing on-screen content. StackLayout``GridFlexLayoutAbsoluteLayoutScrollView,和RelativeLayout每個可用來建立美觀的回應式使用者介面。StackLayout, Grid, FlexLayout, AbsoluteLayout, ScrollView, and RelativeLayout can each be used to create beautiful, responsive user interfaces.


Xamarin.Forms 提供清單檢視控制項以顯示捲動的資料列的資料。Xamarin.Forms provides a list view control to display scrolling rows of data. 這個控制項包含內容的動作,HasUnevenRows自動調整大小、 分隔符號的自訂,以更新提取和頁首和頁尾。The control includes contextual actions, HasUnevenRows automatic sizing, separator customization, pull-to-refresh, and headers and footers.


新增對應需要額外的 NuGet 封裝下載和某些平台特定設定。Adding maps requires an additional NuGet package download and some platform-specific configuration. 完成組態之後,可以在短短幾行程式碼加入地圖和 pin 碼標記。Maps and pin markers can be added in just a few lines of code once the configuration is done.


Picker 檢視是從資料的清單中選取的文字項目控制項。The Picker view is a control for selecting a text item from a list of data.


Slider可讓使用者從連續範圍選取一個數字值。The Slider allows a user to select a numeric value from a continuous range.


Stepper可讓使用者從某個範圍的值中選取一個數字值。The Stepper allows a user to select a numeric value from a range of values. 它包含兩個按鈕加上減號和加號。It consists of two buttons labeled with minus and plus signs. 操作的兩個按鈕會變更選取的值,以累加方式所示。Manipulating the two buttons changes the selected value incrementally.


字型、 色彩和其他屬性,都可以分組為控制項、 版面配置,或使用 Resourcedictionary 的整個應用程式可共用的樣式。Font, color, and other attributes can be grouped into styles which can be shared across controls, layouts, or the entire application using ResourceDictionaries.


資料表檢視類似於清單檢視中,但它適用於資料項目樣式畫面捲動控制項或簡單的捲動功能表而不是較長的資料清單所設計。The table view is similar to a list view, but rather than being designed for long lists of data it is intended for data-entry-style screens of scrolling controls or simple scrolling menus.


Xamarin.Forms 會有數種檢視來呈現和接收的文字。Xamarin.Forms has several views for presenting and receiving text. 文字檢視可以加以自訂和格式化的平台。Text views can be formatted and customized for platforms. 特定字型設定可以讓協助工具功能與相容性。Specific font settings can enable compatibility with accessibility features.


Xamarin.Forms 佈景主題定義特定標準控制項的視覺外觀。Xamarin.Forms Themes define a specific visual appearance for the standard controls. 當您新增至應用程式的資源字典的佈景主題時,會變更標準控制項的外觀。Once you add a theme to the application's resource dictionary, the appearance of the standard controls will change.


TimePicker可讓使用者選取的時間。The TimePicker allows a user to select a time. 它是使用特定的平台上執行應用程式所支援的時間選擇器所實作的。It is implemented using the time picker supported by the particular platform that the application is run on.


Xamarin.Forms 材質視覺效果可用來建立在 iOS 和 Android 上看起來相同或絕大部分都相同的 Xamarin.Forms 應用程式。Xamarin.Forms Material Visual can be used to create Xamarin.Forms applications that look identical, or largely identical, on iOS and Android.

Visual State ManagerVisual State Manager

Visual State Manager 提供的結構化的方式觸發從程式碼,包括變更裝置方向 」 或 「 大小調整的版面配置的使用者介面中的變更。The Visual State Manager provides a structured way to trigger changes in the user interface from code, including layout that adapts to changes in device orientation or size.


Xamarin.Forms 會使用每個平台上的原生 web 瀏覽器控制項,並可以顯示網站、 本機資源,以及產生的 Html 字串。Xamarin.Forms uses the native web browser control on each platform, and can display websites, local resources, and generated Html strings.