Forum Xamarin.Forms

Accessibility in the CollectionView xamarin forms ios

alexuddalexudd SEMember ✭✭

How can i make the CollectionView work with accessiblility? having added the AutomationProperties to the first child of the DataTemplate, the iOS VoiceOver still does not detect the elements.

Please help me guys! :)


  • JuniorJiangJuniorJiang Member, Xamarin Team Xamurai
    edited August 2020

    Hi @alexudd , do you also add the AutomationPropertiesfor CollectionView?

    Such as:

    <CollectionView x:Name="collectionView" AutomationProperties.IsInAccessibleTree="True"
                            ItemsSource="{Binding Monkeys}">

    In addition, also can check in iOS childview renderer . For exampple , if the child view is a Entry, we will custom as follow:

    public class MyEntry : Entry

    Then in iOS renderer code as follow:

    using Xamarin.Forms.Platform.iOS;

    [assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))]
    namespace CustomRenderer.iOS
        public class MyEntryRenderer : EntryRenderer
            protected override void OnElementChanged (ElementChangedEventArgs<Entry> e)
                base.OnElementChanged (e);
                if (Control != null) {
                    // do whatever you want to the UITextField here!
                    //Control.IsAccessibilityElement = true;
                    Console.WriteLine("==================" + Control.IsAccessibilityElement);
  • alexuddalexudd SEMember ✭✭

    Adding IsInAccessibleTree to the parent CollectionView does not solve my issue. Neither does changing the element in the datatemplate to something more straightforward - like a label that should be accessible automatically.

    The problem seem to be with the CollectionView. I Switch to ListView and it works fine.

    Thanks for your help though, have you gotten the CollectionView working with the AccessibleTree?

  • JuniorJiangJuniorJiang Member, Xamarin Team Xamurai
    edited August 2020

    @alexudd No, it doesn't work with the AccessibleTree. Here the workaround is need to use ListView. I will continue to research about CollectionView to achieve that. If good news will update here later.

Sign In or Register to comment.