XAML in Xamarin.Forms 基礎篇 電子書

XAML in Xamarin.Forms 基礎篇 電子書
XAML in Xamarin.Forms 基礎篇 電子書

Xamarin.Forms 快速入門 電子書

Xamarin.Forms 快速入門 電子書
Xamarin.Forms 快速入門 電子書

2018/08/28

使用 Visual Studio 工具箱 Toolbox 來設計頁面 XAML 語言

使用 Visual Studio 2017 15.8 工具箱 Toolbox 來設計頁面 XAML 語言


了解更多關於 [Xamarin.Android] 的使用方式
了解更多關於 [Xamarin.iOS] 的使用方式
了解更多關於 [Xamarin.Forms] 的使用方式
了解更多關於 [Hello, Android:快速入門] 的使用方式
了解更多關於 [Hello, iOS – 快速入門] 的使用方式
了解更多關於 [Xamarin.Forms 快速入門] 的使用方式

在以往我們進行 Xamarin.Forms 專案開發的時候,我們需要使用 C# 來設計這個行動應用程式的商業邏輯運作行為,對於這個行動應用程式,我們將會透過 XAML 宣告標記語言來設計可用於跨平台的頁面之使用者介面內容。不過,要如何使用這項功能呢,您需要升級 VS4W Visual Studio 2017 for Windows 到 Visual Studio 2017 15.8 版本,並且升級到 Xamarin.Forms NuGet 套件到 3.0 以上的版本。
Xamarin.Forms Toolbar
讓我們使用 Prism Template Pack (2.0.9版本) 來建立一個 Xamarin.Forms 專案
Xamarin.Forms Prism Template Pack
當專案建立完成之後,我們打開 MainPage.xaml 檔案,接著,請打開工具箱視窗,若您找不到工具箱視窗,可以點選 Visual Studio 2017 功能表,點選 [檢視] > [工具箱]。不過,您會很失望,雖然,我這裡的 VS2017 已經升級到 15.8 以上版本,可是,還是看不到關於 Xamarin.Form XAML 的工具箱。
Xamarin.Forms MainPage.xaml
檢查一下您的專案使用的 Xamarin.Forms NuGet 套件,結果發現到 Prism Template Pack 專案樣板建立起來的 Xamarin.Forms 專案,使用的是 2.5.0.122203 版本的 NuGet 套件。
Xamarin.Forms Prism Template Pack
因此,我們需要把整個方案中的所有專案都升級到 Xamarin.Forms 3.0 以上版本的 NuGet 套件,不過,若您只是升級 .NET Standard 專案中的 Xamarin.Forms NuGet 套件到最新版本,您將會得到底下錯誤訊息;所以,記得要把所有方案內的專案,都升級 Xamarin.Forms NuGet 套件到最新版本
Xamarin.Forms NuGet 套件
Xamarin.Forms tasks do not match targets. Please ensure that all projects reference the same version of Xamarin.Forms, and if the error persists, please restart the IDE.    XFToolbar.Android
最後,若您完成了上述動作,您可以切換到 MainPage.xaml 視窗中,打開工具箱視窗,您就會看到了 XAML 可以使用到的各個控制項。您可以點選工具箱中 [Controls] / [Layouts] / [Cells] 的任一項目,拖拉到 XAML 適當地方,Visual Studio 就會幫您產生相關 XAML 語法出來。在這裡,我們從 [工具箱] > [Controls] 拖拉 [Entry] 控制項到右邊的 MainPage.xaml 視窗中的 </StackLayout> 項目前,此時,就會自動產生出 Entry 的 XAML 的語言宣告 <Entry Placeholder="" /> 出來
Xamarin.Forms NuGet 套件

關於 Xamarin 在台灣的學習技術資源

Xamarin 實驗室 粉絲團
歡迎加入 Xamarin 實驗室 粉絲團,在這裡,將會經常性的貼出各種關於 Xamarin / Visual Studio / .NET 的相關消息、文章、技術開發等文件,讓您可以隨時掌握第一手的 Xamarin 方面消息。
Xamarin.Forms @ Taiwan
歡迎加入 Xamarin.Forms @ Taiwan,這是台灣的 Xamarin User Group,若您有任何關於 Xamarin / Visual Studio / .NET 上的問題,都可以在這裡來與各方高手來進行討論、交流。
Xamarin 實驗室 部落格
Xamarin 實驗室 部落格 是作者本身的部落格,這個部落格將會專注於 Xamarin 之跨平台 (Android / iOS / UWP) 方面的各類開技術探討、研究與分享的文章,最重要的是,它是全繁體中文。
Xamarin.Forms 系列課程
Xamarin.Forms 系列課程 想要快速進入到 Xamarin.Forms 的開發領域,學會各種 Xamarin.Forms 跨平台開發技術,例如:MVVM、Prism、Data Binding、各種 頁面 Page / 版面配置 Layout / 控制項 Control 的用法等等,千萬不要錯過這些 Xamarin.Forms 課程

沒有留言:

張貼留言