Accessibility in the CollectionView xamarin forms ios RRS feed

  • Question

  • User346618 posted

    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! :)

    Thursday, August 27, 2020 2:05 PM

All replies

  • User380187 posted

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

    Such as:

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

    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 e) { base.OnElementChanged (e);

            if (Control != null) {
                // do whatever you want to the UITextField here!
                //Control.IsAccessibilityElement = true;
                Console.WriteLine("==================" + Control.IsAccessibilityElement);

    } ```

    Friday, August 28, 2020 6:13 AM
  • User346618 posted

    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?

    Friday, August 28, 2020 7:39 AM
  • User380187 posted

    @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.

    Monday, August 31, 2020 6:19 AM