Category / Section
How to vertically center align icons in leading and trailing views in Xamarin TextInputLayout?
1 min read
You can align the icons in leading and trailing view vertically centered by setting VerticalTextAlignment property of Label as Center.
Code snippets [Xaml]:
<inputLayout:SfTextInputLayout ContainerType="Outlined" Hint="Date" UnfocusedStrokeWidth="2" LeadingViewPosition="Inside" OutlineCornerRadius="20"> <inputLayout:SfTextInputLayout.LeadingView> <Label VerticalTextAlignment="Center" Text="🗓" FontSize="16"/> </inputLayout:SfTextInputLayout.LeadingView> <Entry /> </inputLayout:SfTextInputLayout>
Output: