Xamarin Forms - 未找到名称 Horizo​​ntalTextAlignment 的 属性

Xamarin Forms - No Property of name HorizontalTextAlignment found

Xamarin 新手,因此遵循简单的 intro/tutorial (here) 到 Xamarin 表单(在 Mac 上使用 Xamarin Studio)。根据说明,我在 xaml 文件 (HelloXamlPage.xaml) 中输入了以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage    xmlns="http://xamarin.com/schemas/2014/forms" 
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
                x:Class="XamForms.HelloXamlPage"
                Title="Hello XAML Page"
                Padding="10, 40, 10, 10">

  <Label Text="Hello, XAML!"
         VerticalOptions="Start"
         HorizontalTextAlignment="Center"
         Rotation="-15"
         IsVisible="true"
         FontSize="Large"
         FontAttributes="Bold"
         TextColor="Aqua" />

</ContentPage>

代码隐藏文件(HelloXamlPage.xaml.cs)是:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;

namespace XamForms
{
    public partial class HelloXamlPage : ContentPage
    {
        public HelloXamlPage ()
        {
            InitializeComponent ();
        }
    }
}

当我尝试为 Android 或 iOS 构建并 运行 时,出现此错误:Xamarin.Forms.XamlParseException - 未找到名称 Horizo​​ntalTextAlignment 的 属性 .检查文档,这绝对是一个有效的属性。任何 help/ideas 表示赞赏。

您需要使用最新版本的 Xamarin Forms 之一。将您的 Xamarin Forms NuGet 包升级到最新的 2.0.1,您将获得 属性.

2.0.0(或 1.5.2 预发布版)是第一个拥有 属性.

如果您使用以前的 xamarin.forms 版本,您应该使用 'XAlign' 属性 代替。 :)