2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
The Syncfusion SfTextInputLayout control in Xamarin.Forms provides support for color customization in outline Border and assistive labels. Refer to this Getting Started documentation to create a simple TextInputLayout sample. Color Customization for Outline Border: Color customization of outline border can be achieved by setting respective color for FocusedColor (focussed state) and UnfocusedColor (unfocussed state) properties of SfTextInputLayout as shown in below code snippet. <StackLayout VerticalOptions="Center" HorizontalOptions="StartAndExpand"> <inputLayout:SfTextInputLayout Hint="Email" ContainerType="Outlined" HelperText="Enter your email" FocusedColor=" DarkCyan" UnfocusedColor="Gray"><Entry/> </inputLayout:SfTextInputLayout> </StackLayout>
XAML: <Application.Resources> <syncTheme:SyncfusionThemeDictionary> <syncTheme:SyncfusionThemeDictionary.MergedDictionaries> <ResourceDictionary> <x:String x:Key="SfTextInputLayoutTheme">CustomTheme</x:String> <!--Hint Color for focused state--> <Color x:Key="SyncPrimaryLightColor"> Black </Color> <!--Hint Color for default state--> <Color x:Key="SfTextInputLayoutHintColor">Gray</Color> <!--Border Color for focused state--> <Color x:Key="SyncPrimaryColor"> DarkCyan </Color> <!--Border Color for default state--> <Color x:Key="SfTextInputLayoutLineColor">Gray</Color> <!--Helper text Color for default state--> <Color x:Key="SfTextInputLayoutHelperTextColor"> BlueViolet</Color> <!--Character count text Color for default state--> <Color x:Key="SfTextInputLayoutCounterLabelColor"> DarkGoldenrod</Color> <!--Error text Color for default state--> <Color x:Key="SfTextInputLayoutErrorTextColor">Red</Color> </ResourceDictionary> </syncTheme:SyncfusionThemeDictionary.MergedDictionaries> </syncTheme:SyncfusionThemeDictionary> </Application.Resources> To know more information about customization using keys in theme dictionary, refer the documentation: keys View the sample in GitHub |
2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.
Hi Syncfusion,
I have tried the following code but it is showing the following error, which means to add the key: "resources in ResourceDictionary require a x:Key attribte".
Is it required to add the key?
And how to make these style get applied to some specific fields and not all SfTextInputLayout.
Is it required to add the key? Yes. It is required, based on that only color has been applied.
How to make these styles get applied to some specific fields and not all SfTextInputLayout.
It has been achieved by adding the Resource with Syncfusion theme only for the desired SfTextInputLayout as per in below code snippet
[XAML]
Reference sample