MainPage.xaml.cs 881 Bytes
Newer Older
Poli97's avatar
Poli97 committed
1 2 3 4 5 6 7 8 9 10 11 12 13
using System;
using System.ComponentModel;
using Xamarin.Forms;

namespace CustomViewAccessibility
{
    [DesignTimeVisible(false)]
    public partial class MainPage : ContentPage
    {
        
        public MainPage()
        {
            InitializeComponent();
Paolo Pecis's avatar
Paolo Pecis committed
14
            Title = "Xamarin accessibility events";
Poli97's avatar
Poli97 committed
15 16 17

            Button notAccessibleButton = new Button
            {
Paolo Pecis's avatar
Paolo Pecis committed
18
                Text = "Button 1",
Paolo Pecis's avatar
Paolo Pecis committed
19
                BackgroundColor = Color.LightGray,
Poli97's avatar
Poli97 committed
20 21 22
            };
            stacklayout.Children.Add(notAccessibleButton);

Paolo Pecis's avatar
Paolo Pecis committed
23 24 25 26 27
            IAccessibleButton accessibleButton = new IAccessibleButton
            {
                Text = "NOT IN FOCUS",
                TextColor = Color.Black,
            };
Poli97's avatar
Poli97 committed
28 29 30 31 32 33 34
            AutomationProperties.SetIsInAccessibleTree(accessibleButton, true);
            stacklayout.Children.Add(accessibleButton);

        }

	}
}