We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the color of border and labels in SfTextInputLayout

Platform: Xamarin.Forms |
Control: SfTextInputLayout |
Published Date: May 22, 2019 |
Last Revised Date: March 17, 2020

In addition to the available public properties in SfTextInputLayout, you can deeply customize the SfTextInputLayout using the DynamicResource keys also.

The following code sample demonstrates how to style the border and labels used in SfTextInputLayout using the following DynamicResource keys:

  • SfTextInputLayoutFloatedHintUnfocusedColor
  • SfTextInputLayoutLineColor
  • SfTextInputLayoutHelperTextColor
  • SfTextInputLayoutCounterLabelColor

Similarly, you can customize the appearance of the SfTextInputLayout by overriding the corresponding keys. You can check the keys and the UI elements to which they are mapped in this documentation.

Code snippets [Xaml]:

    <ContentPage.Resources>
        <syncTheme:SyncfusionThemeDictionary>
            <syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <x:String x:Key="SfTextInputLayoutTheme">CustomTheme</x:String>
                    <Color x:Key="SfTextInputLayoutFloatedHintUnfocusedColor">Blue</Color>
                    <Color x:Key="SfTextInputLayoutLineColor">Red</Color>
                    <Color x:Key="SfTextInputLayoutHelperTextColor">Green</Color>
                    <Color x:Key="SfTextInputLayoutCounterLabelColor">Violet</Color>
                </ResourceDictionary>
            </syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
        </syncTheme:SyncfusionThemeDictionary>
    </ContentPage.Resources>
 
    <StackLayout>
        <inputLayout:SfTextInputLayout
            ContainerType="Outlined"
            EnablePasswordVisibilityToggle="true"
            HelperText="Enter password"
            Hint="Password"
            ShowCharCount="True">
            <Entry Text="John" />
        </inputLayout:SfTextInputLayout>
    </StackLayout>

  

Output:

Customization of SfTextInputLayout appearance

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile