Add color in WatermarkText

2 posts, 0 answers
  1. Tahmina
    Tahmina avatar
    13 posts
    Member since:
    Mar 2018

    Posted 08 Feb Link to this post

    Hi

    We are using RadEntry as entry in our project. If you see the attached image, we want to use WatermarkText as placeholder where the text will have regular color & asterisk will be in red. Is it possible in  RadEntry?

  2. Lance | Technical Support Engineer, Principal
    Admin
    Lance | Technical Support Engineer, Principal avatar
    1039 posts

    Posted 08 Feb Link to this post

    Hello Tahmina,

    There aren't any properties that let you set a different color for different letters in the WatermarkText, the WatermarkTextColor is used for the entire word.

    If this is your goal, you can put a separate Label outside the RadEntry for the red asterisk, and show/hide that depending on if there's any Text in the RadEntry.

    For example:

    <StackLayout Orientation="Horizontal">
        <input:RadEntry WatermarkText="First name" WatermarkTextColor="LightGray" Margin="0" TextChanged="RadEntry_OnTextChanged"/>
        <Label x:Name="AsteriskLabel" Text="*" TextColor="Red" Margin="0" />
    </StackLayout>

    private void RadEntry_OnTextChanged(object sender, TextChangedEventArgs e)
    {
        AsteriskLabel.IsVisible = e.NewTextValue.Length == 0;
    }


    Regards,
    Lance | Technical Support Engineer, Principal
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top