Accessibility in Xamarin Segmented Control (SfSegmentedControl)

The segmented control supports automating each segment item in control using the AutomationId property. The AutomationId value given for control will be appended with each segment item’s text value, and it can be used for writing automation scripts. The following code snippet explains how to set AutomationId value to the segmented control.

<syncfusion:SfSegmentedControl AutomationId="SegmentedControl1" ItemsSource="{Binding Segments}" />
ViewModel viewModel = new ViewModel();
SfSegmentedControl sfSegmented = new SfSegmentedControl();
sfSegmented.AutomationId = "SegmentedControl1";
sfSegmented.ItemsSource = viewModel.Segments;

public class ViewModel
{
    public ObservableCollection<SfSegmentItem> Segments { get; set; }

    public ViewModel()
    {
        Segments = new ObservableCollection<SfSegmentItem>();
        Segments.Add(new SfSegmentItem() { Text = "Max" });
        Segments.Add(new SfSegmentItem() { Text = "Roger" });
        Segments.Add(new SfSegmentItem() { Text = "Evans" });
        Segments.Add(new SfSegmentItem() { Text = "John" });
        Segments.Add(new SfSegmentItem() { Text = "Peter" });
        Segments.Add(new SfSegmentItem() { Text = "Mike" });
    }    
}

The following table shows that the AutomationId value is set to each segment item in control for the above code snippet.

Segment item AutomationId
Max SegmentedControl1_Max
Roger SegmentedControl1_Roger
Evans SegmentedControl1_Evans
John SegmentedControl1_John
Peter SegmentedControl1_Peter
Mike SegmentedControl1_Mike