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

HintLabelStyle didnt work , need example to set the TextColor

Hello,

im trying to set a hintlabelstyle to the propertie HintLabelStyle

<textInputLayout:SfTextInputLayout Hint="Vereinbart Am"
                                                           HintLabelStyle="xxx"


this is the style wich is not working:

            <!-- HintLabelStyle -->
            <Style x:Key="HintLabelStyleDefault" TargetType="textInputLayout:LabelStyle">
                <Setter Property="TextColor" Value="Black"/> <<<<< 'this value TextColor didnt exist at LabelStyle'
            </Style>

How is the style correct i need to change the TextColor of the Hint in the SfTextInputLayout.

Greets Johannes


3 Replies

RA Rachel A Syncfusion Team January 3, 2020 06:21 AM UTC

Hi Johannes, 
 
Greetings from Syncfusion. 
 
We have provided support to set the text color for the hint by specifying the keys in theme dictionary as provided in the below code snippet. 
 
[App.XAML] 
<Application.Resources> 
        <syncTheme:SyncfusionThemeDictionary> 
            <syncTheme:SyncfusionThemeDictionary.MergedDictionaries> 
                <ResourceDictionary> 
                    <x:String x:Key="SfTextInputLayoutTheme">CustomTheme</x:String> 
                    <Color x:Key="SfTextInputLayoutHintColor">Red</Color> 
                    <Color x:Key="SyncPrimaryLightColor">Red</Color>                  
                </ResourceDictionary> 
            </syncTheme:SyncfusionThemeDictionary.MergedDictionaries> 
        </syncTheme:SyncfusionThemeDictionary> 
    </Application.Resources> 
 
Also, to know more about customization using themes check the below documentation link. 
 
 
Regards, 
Rachel. 



JR Jassim Rahma replied to Rachel A November 10, 2021 09:14 PM UTC

Hi,

What if I want to set for specific control?

For example if I have two SfTextInputLayout, TextBoxSigninEmailAddress and TextBoxSigninMobile:

<SyncfusionInputLayout:SfTextInputLayout HeightRequest="60" Hint="Email Address" ContainerType="Outlined">
    <Entry x:Name="TextBoxSigninEmailAddress" IsTextPredictionEnabled="False" Keyboard="Email" FlowDirection="LeftToRight" HorizontalTextAlignment="Center" />
</SyncfusionInputLayout:SfTextInputLayout>


<SyncfusionInputLayout:SfTextInputLayout HeightRequest="60" Hint="Email Address" ContainerType="Outlined">
    <Entry x:Name="TextBoxSigninMobile" IsTextPredictionEnabled="False" Keyboard="Number" FlowDirection="LeftToRight" HorizontalTextAlignment="Center" />
</SyncfusionInputLayout:SfTextInputLayout>


and I want to set the color of TextBoxSigninEmailAddress's Hint to Red but TextBoxSigninMobile to Black because TextBoxSigninEmailAddress is a Required field.


Also, the TextBoxSigninMobile will be Blackin Light and White in Dark


Kindly help..

Thanks

Jassim



ET Eswaran Thirugnanasambandam Syncfusion Team November 11, 2021 02:13 PM UTC

Hi Jassim, 
 
Greetings from Syncfusion. 
 
Query 1: What if I want to set color for specific control? 
We have checked your requirement and we would like to inform you that, in 2021 Volume 3 main release (19.3.0.43 version) we have included the support for changing the hint label color using the Color property of the LabelStyle. So, you can use this instead of our theme dictionary support which is earlier suggested in this thread. Please find the snippet below. 
[XAML] 
<SyncfusionInputLayout:SfTextInputLayout HeightRequest="60"  
                                                                              Hint="Email Address"  
                                                                              ContainerType="Outlined"> 
    <SyncfusionInputLayout:SfTextInputLayout.HintLabelStyle> 
        <SyncfusionInputLayout:LabelStyle Color="Red"   
                                                                       FontSize="16"/> 
    </SyncfusionInputLayout:SfTextInputLayout.HintLabelStyle> 
    <Entry x:Name="TextBoxSigninEmailAddress"  
                 IsTextPredictionEnabled="False"  
                 Keyboard="Email"  
                 FlowDirection="LeftToRight"  
                 HorizontalTextAlignment="Center" /> 
</SyncfusionInputLayout:SfTextInputLayout> 
 
The Volume 3 Main release notes link is provided below. 
 
Please refer to the below user guide documentation for applying color to the hint label 
 
We have prepared a sample to achieve your requirement and please get the sample from the below link. 
 
Please check the sample let us know if you need any further assistance.  
 
Query 2: The TextBoxSigninMobile will be Blackin Light and White in Dark 
This requirement can be achieved by using the default Hint label color and it will be changed based on the theme since we are using Xamarin forms label as hint label. If the hint label color is set as Black, then we have to change the color value based on the theme using Dynamic Resource. 
 
Regards,  
Eswaran. 


Loader.
Live Chat Icon For mobile
Up arrow icon