using System; using System.Collections.Generic; using SampleApp.DependencyServices; using Xamarin.Forms; namespace SampleApp.Views { public partial class Functionality21 : ContentPage { IScreenReaderEnabled screenReaderEnabled; public Functionality21() { InitializeComponent(); screenReaderEnabled = DependencyService.Resolve(); Label q = new Label { Text = "Is Screen Reader Active?", }; Label y = new Label { Text = "", TextColor = Color.Green, }; Label n = new Label { Text = "", TextColor = Color.Red, }; background.Children.Add(q); background.Children.Add(y); background.Children.Add(n); AutomationProperties.SetIsInAccessibleTree(q, true); AutomationProperties.SetIsInAccessibleTree(y, true); AutomationProperties.SetIsInAccessibleTree(n, true); if (screenReaderEnabled.IsScreenReaderEnabled()) { y.Text = "YES"; } else { n.Text = "NO"; } } } }