Issue
Hi guys I've been looking into a solution to set the placeholder of an entry to italic.
Solution
I have an unusual solution to get the effect you want.
At first, set the FontAttributes as Italic in the xaml, such as:
<Entry x:Name="test" FontAttributes="Italic" Placeholder="Placeholder" TextChanged="test_TextChanged"/>
And then, change the FontAttributes to None in the TextChanged Event, such as:
private void test_TextChanged(object sender, TextChangedEventArgs e)
{
Entry entry = sender as Entry;
if(entry.Text.Length > 0)
{
entry.FontAttributes = FontAttributes.None;
}
else
{
entry.FontAttributes = FontAttributes.Italic;
}
}
Answered By - Liyun Zhang - MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.