Вы можете попробовать следующий обходной путь:
Оберните Entry
и Label
в StackLayout
.И сделайте StackLayout
как Entry с заполнителем.
Код выглядит так:
MainPage.xaml:
<StackLayout Orientation="Horizontal" HorizontalOptions="Center"
VerticalOptions="CenterAndExpand">
<Entry x:Name="ABS_ID"
Text="Enter Name Here "
HorizontalOptions="Start"
Focused="OnEntryFocused"
Unfocused="OnEntryUnFocused"/>
<Label x:Name="ABS_ID2"
Text="*"
TextColor="Red"
HorizontalOptions="StartAndExpand"
VerticalTextAlignment="Center"
Margin="-20"/>
</StackLayout>
MainPage.xaml.cs:
public partial class MainPage : ContentPage
{
bool showPlaceHolder = true;
public MainPage()
{
InitializeComponent();
}
void OnEntryFocused(object sender, EventArgs e)
{
if (showPlaceHolder) {
ABS_ID.Text = "";
ABS_ID2.Text = "";
}
}
void OnEntryUnFocused(object sender, EventArgs e)
{
if ((ABS_ID.Text == "") && (ABS_ID2.Text == ""))
{
ABS_ID.Text = "Enter Name Here ";
ABS_ID2.Text = "*";
showPlaceHolder = true;
}
else {
showPlaceHolder = false;
}
}
}
И результат: