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
close icon

Keep Hint text from appearing at top of field when user enters text

I am trying to build a style for SfTextInput that will have Hint text in the field but I don't want the Hint text to move to the top of the field when the user starts to enter text (I would like the hint text to go away once a user enters text but reappear if the user clears the field). I have pasted in my test code and two images.

    <StackLayout x:Name="InputContainer" VerticalOptions="StartAndExpand" Padding="10, 0, 10, 0">
        <inputLayout:SfTextInputLayout x:Name="TextInputLayout" Style="{DynamicResource SfTextInputStyle}" Hint="Enter Your Answer" IsHintAlwaysFloated="False">
            <Editor x:Name="TextInput" TextChanged="TextChanged" Unfocused="TextInputUnfocused" AutoSize="TextChanges" />
        </inputLayout:SfTextInputLayout>
    </StackLayout>

Thanks for your help,

Brian Swanson

Attachment: Archive_a02acfa4.zip

3 Replies

RA Rachel A Syncfusion Team December 16, 2019 05:34 AM UTC

Hi Brian, 
 
Greetings from Syncfusion. 
 
We can retain the position of the hint text inside the container itself by setting EnableFloating property as false same as in the below code snippet. 
 
[XAML] 
  <textinputlayout:SfTextInputLayout EnableFloating="False" Hint="Type Text"> 
        <Entry ></Entry> 
   </textinputlayout:SfTextInputLayout> 
 
Screenshots: 
 
   
 
For more information on hint text, refer the below documentation link. 
 
 
Thanks, 
Rachel. 



BS Brian Swanson December 16, 2019 04:15 PM UTC

Rachel,

Thank you. That worked.

- Brian


LR Lakshmi Radha Krishnan Syncfusion Team December 17, 2019 05:49 AM UTC

Hi Brian,

We are glad that the provided solution works.

Regards,
Lakshmi R.

Loader.
Live Chat Icon For mobile
Up arrow icon