Accessibility in Xamarin Cards

12 May 20211 minute to read

The SfCardLayout control has built-in automation Id for inner elements. The AutomationId API allows the automation framework to find and interact with the inner elements of the SfCardLayout control. To keep unique AutomationId, these inner elements’ AutomationIds are updated based on the control’s AutomationId.

For example, if you set SfCardLayouts’ AutomationId as “CardLayout” and also enable the accessibility option in mobile device to read text, then the automation framework will interact with SfCardLayout inner elements and voice over the text like “CardLayout SfCardLayoutItem 2 of 3” (2 denotes the current item and 3 denotes the total count) when you swipe the card.


Accessibility support works on Android and iOS platform only.

<cards:SfCardLayout SwipeDirection="Left" HeightRequest="500" BackgroundColor="#F0F0F0">

		<Label  Text="Cyan" BackgroundColor="Cyan"/>

		<Label  Text="Yellow" BackgroundColor="Yellow"/>

		<Label  Text="Orange" BackgroundColor="Orange"/>

SfCardLayout cardLayout = new SfCardLayout();

//Add children for card layout 
cardLayout.Children.Add(new SfCardView(){Content = new Label(){ Text="Cyan", BackgroundColor=Color.Cyan }});

cardLayout.Children.Add(new SfCardView(){Content = new Label(){ Text="Yellow", BackgroundColor=Color.Yellow }});

cardLayout.Children.Add(new SfCardView(){Content = new Label(){ Text="Orange", BackgroundColor=Color.Orange }});

this.Content = cardLayout;

Initializing Xamarin.Forms SfCardLayout