Functionality2.xaml.cs 1.71 KB
Newer Older
Mattia's avatar
Mattia committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
using System;
using System.Collections.Generic;

using Xamarin.Forms;

namespace SampleApp.Views
{
    public partial class Functionality2 : ContentPage
    {
        Boolean topDown = true;
        public Functionality2()
        {
            InitializeComponent();

            FocusOrderLabel.Text = "Focus order is: TOP-DOWN";

            AutomationProperties.SetIsInAccessibleTree(FocusOrderLabel, true);
            AutomationProperties.SetIsInAccessibleTree(label1, true);
            AutomationProperties.SetIsInAccessibleTree(label2, true);
            AutomationProperties.SetIsInAccessibleTree(label3, true);
            AutomationProperties.SetIsInAccessibleTree(label4, true);
            AutomationProperties.SetIsInAccessibleTree(ChangeButton, true);
            label1.TabIndex = 1;
            label2.TabIndex = 2;
            label3.TabIndex = 3;
            label4.TabIndex = 4;
            ChangeButton.TabIndex = 5;
            
        }

        async void OnButtonClicked(object sender, EventArgs args)
        {
            if (topDown)
            {
                label2.Text = "3";
                label2.TabIndex = 3;
                label3.Text = "2";
                label3.TabIndex = 2;
                ChangeButton.Text = "Change focus order to top-down";
                FocusOrderLabel.Text = "Focus order is: LEFT-RIGHT";
            }
            else
            {
                label2.Text = "2";
                label2.TabIndex = 2;
                label3.Text = "3";
                label3.TabIndex = 3;
                ChangeButton.Text = "Change focus order to left-right";
                FocusOrderLabel.Text = "Focus order is: TOP-DOWN";
            }
            topDown = !topDown;
        }
    }
}