AppThemeBinding doesn't work for Hint label

Using 
Syncfusion.Maui.Core 26.1.39


My page:

<?xml version="1.0" encoding="utf-8"?>
<ContentPagexmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="TestMauiApp.MainPage"
             xmlns:syncore="clr-namespace:Syncfusion.Maui.Core;assembly=Syncfusion.Maui.Core">


    <ScrollView>
        <syncore:SfTextInputLayoutHint="Test">
            <EntryText="TEst"/>
        </syncore:SfTextInputLayout>
    </ScrollView>


</ContentPage>


My styling:

<StyleTargetType="syncore:SfTextInputLayout"x:Key="DefaultSfTextInputLayoutStyle">
    <SetterProperty="ContainerType"Value="None"/>
    <SetterProperty="Margin"Value="3,10,3,3"/>
    <SetterProperty="ReserveSpaceForAssistiveLabels"Value="false"/>
    <SetterProperty="InputViewPadding"Value="0,10,0,5"/>
    <SetterProperty="HintLabelStyle">
        <Setter.Value>
            <syncore:LabelStyleTextColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}"FontSize="14"/>
        </Setter.Value>
    </Setter>
</Style>
<StyleTargetType="syncore:SfTextInputLayout"BasedOn="{StaticResource DefaultSfTextInputLayoutStyle}"/>



Hint label color does not change at runtime. It only  applies after restarting the app. If i change value in styles.xaml hot reload can apply it.

Image_8001_1719822198901


Image_7424_1719822216316




3 Replies

AA Aarthi Arjunan Syncfusion Team July 2, 2024 12:46 PM UTC

Hi bartek goka,


Thank you for reaching out to us. We have investigated your query.


I would like to bring to your attention an issue we are experiencing with the latest Maui framework. To resolve this issue we suggest you to set a separate Label style for each theme in the HintLabelStyle property to dynamically apply the appropriate LabelStyle based on the current app theme. We have prepared a sample for your reference,  which is attached. It works fine based on both the Dark and Light themes. Please review the sample and let us know your feedback.


<syncore:LabelStyle x:Key="textInputHintLabelStyle" TextColor="White" FontSize="16"/>

<syncore:LabelStyle x:Key="textInputHintLabelStylelight" TextColor="Black" FontSize="16"/>


<Style TargetType="syncore:SfTextInputLayout" x:Key="DefaultSfTextInputLayoutStyle">

    <Setter Property="ContainerType" Value="None"/>

    <Setter Property="Margin" Value="3,10,3,3"/>

    <Setter Property="ReserveSpaceForAssistiveLabels" Value="false"/>

    <Setter Property="InputViewPadding" Value="0,10,0,5"/>

  
<Setter Property="HintLabelStyle" Value="{AppThemeBinding Dark={StaticResource textInputHintLabelStyle},Light={StaticResource textInputHintLabelStylelight}}"/>

</Style>


Please let us know whether the provided suggestion helps to resolve your query. Please don’t hesitate to contact us if you have any concerns or queries.


Regards,

Aarthi A.



Attachment: TextInputLayoutStyle_5f062d7d.zip


BG bartek góka replied to Aarthi Arjunan July 3, 2024 07:49 AM UTC

Thank you, it works



PR Preethi Rajakandham Syncfusion Team July 4, 2024 04:44 AM UTC

Hi bartek góka,

You're welcome. 

We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out.

Regards,

Preethi R


Loader.
Up arrow icon