天天看點

使您的Xamarin.Forms應用程式可通路

iOS,Android和Windows都會為開發人員公開API,為每個人建構可通路的移動應用。 我們很高興地宣布,我們在Xamarin.Forms中添加了可用性的新API,以便開發人員更輕松地建構可通路的跨平台移動應用程式。 在這篇文章中,我們将介紹添加到Xamarin.Forms中的新API,進而輕松建構可通路的移動應用程式。

AutomationProperties.Hint

AutomationProperties.IsInAccessibleTree

AutomationProperties.LabeledBy

AutomationProperties.Name

點選(此處)折疊或打開

toolkit:EntryLine

        Text="{Binding Email}"

        Keyboard="Email"

        HorizontalOptions="FillAndExpand"

        Placeholder="email address"

        x:Name="EntryEmail"

        StyleId="EmailTextField"

        IsEnabled="{Binding IsNotBusy}"

        BorderColor="#ECECEC"

        AutomationProperties.Hint="Enter your email here"

        AutomationProperties.IsInAccessibleTree="true"

        AutomationProperties.Name="Email entry field">

        toolkit:EntryLine.HorizontalTextAlignment>

            OnPlatform x:TypeArguments="TextAlignment" iOS="Center"/>

        /toolkit:EntryLine.HorizontalTextAlignment>

/toolkit:EntryLine>

在啟用輔助功能的實體裝置上運作代碼,并為使用者提供為AutomationProperties.Hint提供的值。 這在iOS上使用VoiceOver 在Android上,一些控件,包括Button,不幸的是,由于與Android本身有關的原因,它們的行為不正确,盡管Slider等元素将讀取“提示”和“名稱”值的組合。

記住,您将需要将Xamarin.Forms 2.3.5添加到使用Xamarin.Forms的所有項目中,包括您的iOS和Android項目。 請注意,IntelliSense中的AutomationProperties屬性可能不可用,因為它們是附加的屬性。

繼續閱讀