- Home
- Forum
- Xamarin.Forms
- SfTextInputLayoutStyle override default style for disabled state
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?
SIGN IN To post a reply.
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]:
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.
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
-
JM Jan Minarik
- Mar 20, 2019 04:54 PM UTC
- Jun 15, 2021 01:49 PM UTC