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

SfTextInputLayoutStyle override default style for disabled state

I use Xamarin.Forms 3.6.0.264807 and Syncfusion.Xamarin.SfTextInputLayoutStyle 17.1.0.32-beta.

IsEnabled is set to false. I would like override style (text color and border color) for this UI state . It’s possible? 

3 Replies

BK Bharathiraja K Syncfusion Team March 21, 2019 06:45 AM UTC

Hi Jan, 
 
Greetings from Syncfusion,  
 
When the text input layout is in a disabled state, we can override the color of text (hint label, helper text, error text, counter label) and border (line/Border color in filled/outlined type text input layout respectively) through the resource keys in control style resource dictionary. You can change the text color of input view (like Entry) in SfTextInputLayout by setting TextColor property. To know more about these, please find the documentation link below,  
 
We have provided the code snippet and sample link for the same, 
Code Snippet [XAML]: 
    <ContentPage.Resources> 
        <syncTheme:SyncfusionThemeDictionary> 
            <syncTheme:SyncfusionThemeDictionary.MergedDictionaries> 
                <ResourceDictionary> 
                    <x:String x:Key="SfTextInputLayoutTheme">CustomTheme</x:String> 
                    <Color x:Key="SfTextInputLayoutFilledLineDisabledColor">Blue</Color> 
                    <Color x:Key="SfTextInputLayoutOutlinedLineDisabledColor">Blue</Color> 
                    <Color x:Key="SfTextInputLayoutDisabledHintColor">Blue</Color> 
                    <Color x:Key="SfTextInputLayoutFloatedHintDisabledColor">Blue</Color> 
                    <Color x:Key="SfTextInputLayoutHelperTextDisabledColor">Blue</Color> 
                </ResourceDictionary> 
            </syncTheme:SyncfusionThemeDictionary.MergedDictionaries> 
        </syncTheme:SyncfusionThemeDictionary> 
    </ContentPage.Resources> 
 
 
Sample link, 
 
Regards, 
Bharathi. 



MA Maxime June 11, 2021 02:58 PM UTC

Hello,

Is there a way to achieve this programmatically please ?

I tried this, but it doesn't work :

SyncfusionThemeDictionary syncfusionThemeDictionary = new SyncfusionThemeDictionary();

ResourceDictionary resourceDictionary = new ResourceDictionary();
resourceDictionnary.Add("SfTextInputLayoutTheme", "CustomTheme");
resourceDictionnary.Add("SfTextInputLayoutDisabledHintColor", "Blue");
resourceDictionnary.Add("SfTextInputLayoutFloatedHintDisabledColor", "Blue");
resourceDictionnary.Add("SfTextInputLayoutHelperTextDisabledColor", "Blue");

syncfusionThemeDictionary.MergedDictionaries.Add(resourceDictionnary);

myContentPage.Resources.Add(syncfusionThemeDictionary);


Thank you in advance !



SS Sridevi Sivakumar Syncfusion Team June 15, 2021 01:49 PM UTC

Hi Jan Minarik,

We checked the reported problem and it can be fixed by adding the resource dictionaries above of InitializeComponent() as per the below code snippet

[XAML]:
 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:syncTheme="clr-namespace:Syncfusion.XForms.Themes;assembly=Syncfusion.Core.XForms" 
 
              xmlns:inputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms" 
             x:Class="GettingStarted.Page1"> 
    <StackLayout> 
        <inputLayout:SfTextInputLayout x:Name="textinput" 
                                       ContainerType="Outlined" 
                                       IsEnabled="False" 
                                       HelperText="Enter your email address" 
                                  Hint="Email"> 
            <Entry x:Name="entry" Text="Email" TextColor="Blue" /> 
        </inputLayout:SfTextInputLayout> 
    </StackLayout> 
</ContentPage> 

[C#]:
 
 public partial class Page1 : ContentPage 
    { 
        public Page1() 
        { 
            SyncfusionThemeDictionary syncfusionThemeDictionary = new SyncfusionThemeDictionary(); 
            ResourceDictionary resourceDictionnary = new ResourceDictionary(); 
            resourceDictionnary.Add("SfTextInputLayoutTheme", "CustomTheme"); 
            resourceDictionnary.Add("SfTextInputLayoutDisabledHintColor", "Blue"); 
            resourceDictionnary.Add("SfTextInputLayoutFloatedHintDisabledColor", "Blue"); 
            resourceDictionnary.Add("SfTextInputLayoutHelperTextDisabledColor", "Blue"); 
            syncfusionThemeDictionary.MergedDictionaries.Add(resourceDictionnary); 
            this.Resources.Add(syncfusionThemeDictionary); 
            InitializeComponent(); 
        } 
    } 

Let us know if you need any further assistance.

Regards,
Sridevi S.
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon