Skip to main content
Logo Appt Light

Input label on Xamarin

Input fields should have labels so that users know what input data is expected. These labels should stay visible while users are entering data. A placeholder which disappears while entering data does not count as a label.

In Xamarin, you can use the AutomationProperties.LabeledBy property to link a label to an input field. However, LabeledBy only works on Android.

You can also link a Label to an Entry by setting IsInAccessibleTree to false on the label, and setting AutomationProperties.Name property to the value of the label.

<Label x:Name="label" 
       Text="Name" 
       AutomationProperties.IsInAccessibleTree="false" />

<Entry AutomationProperties.Name="{x:Reference label}"
       AutomationProperties.LabeledBy="{x:Reference label}" />

Feedback?

Let us know!